Hey Atefeh,
I apologize for the delay. After reading your response, I think I better understand your scenario now.
It sounds like you are heading towards keeping the deployment-related variables in Octopus, which I would definitely recommend. Things like resource group names, locations, function names, and anything else which is a deployment concern and changes between environments is better modeled in Octopus. Because you’re right, you shouldn’t have to rebuild in order to modify these variables.
Which leaves you with the versioning problem…
If I understand correctly, you want to keep the release number in Octopus and the package version in-sync. Which is a problem, because there are two reasons you may create a new release:
- The application source code has changed and Jenkins has rebuilt the package
- You have modified variables in Octopus
There are a few options.
Option 1
One possible approach (the one that we use internally) is to make use of SemVer pre-release versions. For example, if the next release of your application is going to be 3.5.0.0
, then every commit gets built by Jenkins as (for example)
3.5.0.0-ci.1
3.5.0.0-ci.2
3.5.0.0-ci.3
- …
And these can be used as the release numbers in Octopus. If you need to change a variable in Octopus, you can manually create the release in Octopus and simply increment the release version, e.g. 3.5.0.0-ci.3.4
The semver ordering rules will handle this nicely. As a side benefit, you can use channels in Octopus to use a different lifecycle for these pre-release versions which doesn’t allow them to be deployed to production.
Then only when you are happy with both the functionality and deployment of a release do you create the release version. This may be when testing is complete, for example. You would then have Jenkins build the package as 3.5.0.0
. We do this by tagging the commit, as we use GitVersion.
By using pre-release versions, you may also find you don’t need a 4-part version for your packages.
For us, it also means we don’t “burn” our public release numbers on builds that don’t progress to production.
Option 2
The approach above probably requires some work on your build pipeline to implement. Another option, which again leverages semver components, is when changing variables in Octopus, and you want to create a new release manually, you could simply use the current release number with a metadata component added, for example, if the current release is 3.5.0.1
and you need to modify variables, the new release could be created as 3.5.0.1+001
. The new release would contain the same package, 3.5.0.1
as the previous release, but with the updated variables.
Anyone looking at this release number would learn to understand that it contained package version 3.5.0.1
Option 3
A third option is when modifying variables in Octopus, and you want to create a new release with a version that has already been used, to simply delete the existing release.
This will allow you to create the new release manually and re-use the existing version.
I’d be interested to hear your thoughts on these options? Could they work for you?
If I haven’t explained any of those well enough (very possible), then please say
Also, another question: How often do you see think you will modify these variables in Octopus? What causes them to change?