I have four environments, Dev -> Test -> Staging -> Production. The majority of the time, I want my releases to go to each environment. However, when I have an emergency bug fix, I want to skip Dev and Test and go right to staging. Should I make Dev and Test optional? What are the recommendations for this situation?
Making Dev and Test optional in the lifecycle is an approach. But consider the ramifications. For one, in making them optional you cannot force your developers to verify anything before deploying to staging.
Our recommendation is to have two lifecycles, a default lifecycle and a emergency fix lifecycle. The emergency fix lifecycle will skip Dev and Test and go directly to staging.
In your deployment process, you will want to add another channel. In my case I called it
That channel will be configured to use the emergency fix lifecycle.
When you need to create an release to deploy that bug fix you will need to select that channel.
On the project overview screen the channel will appear in a new section
If you do this, ensure the
Discrete Channel Release setting is configured for
Considered for entire project. Once that release is deployed to staging it will overwrite whatever is out there. This setting will ensure the UI reflects that.
For an added layer of protection, you can add a manual intervention which only runs for that specific channel in staging.
All of our build server plug-ins expose the channel property as an option when creating a release.
With that property, you can create a script that runs on the build server which that looks at the branch which triggered the build. If a build is triggered on a bugfix branch then use the bugfix channel. You will have to refer to your build server documentation on how to set variables in one step and use them in another step.
For more information about channels and lifecycles, read here: https://octopus.com/blog/channels-walkthrough