aliasing jenkins artifact URLs

前端 未结 2 819
终归单人心
终归单人心 2021-01-13 01:13

Jenkins artifact URLs allow abstracting the \"last successful build\", so that instead of

http://myjenkins.local/job/MyJob/38/artifact/build/MyJob-v1.0.1.zip         


        
2条回答
  •  庸人自扰
    2021-01-13 01:22

    There is actually a plugin to assign aliases to build you've run, and I have found it pretty handy: the Build Alias Setter Plugin.

    You can use it for instance to assign an alias in the form of your own version number for a build, instead (or rather in addition) to the internal Jenkins-assigned build number. I found that it is usually most practical to use it in conjunction with the EnvInject plugin (or your favorite variant): you would export an env variable (e.g. MY_VAR=xyz) with a value to the target version or moniker, and then use the form ${ENV,var="myvar"} in the "Token Macro alias" config that the plugin provides in your job config.

    You can also use it to assign aliases in the form of "lastSuccesful" if you have such a need, which allows you to distinguish between different types of successful (or other state) builds.

    Wait thee's more! You can also use the /*zip*/ trick in conjunction with the alias setter as well.

提交回复
热议问题