Auto-increment release version Jenkins

后端 未结 4 1544
心在旅途
心在旅途 2021-02-03 10:40

I have an application that builds in Jenkins and that I want to deploy to Octopus. When I am doing this I have to create a release version that is send to Octopus. For this rele

4条回答
  •  半阙折子戏
    2021-02-03 11:16

    Jenkins provides some environment variables available to each build command; one of those is the build number, an increasing number.

    If you can accommodate with holes in your version numbers, change your version to include the build number, like 4.8-142 where 142 is the build number from jenkins. This gives you increasing version numbers in the semver sense and still let you control the real version in a more functional way.

    If you are not happy with the build number in your version, then you should have a post build script that updates the version number and stores that in a file somewhere. You could then inject that file content with either the EnvInject plugin or using a parametrized build.

提交回复
热议问题