I want to fail my production deployment if the version I’m deploying to production does not match the version currently in my staging environment. Essentially I want to do something like:
If (Staging.Octopus.Release.Number -ne Octopus.Release.Number){
Write-Error “Deployment failed since release is not the current staging release”
}
The rest of my deployment
Is that possible?
(I want this because my production deployment logic always deploys the current staging environment, so if a user tried to deploy a release that is not currently in staging they will always end up deploying the version in staging anyway - which could lead to some odd human error.)
On 2.6 pre-release we added Lifecycles which seems exactly what you want to do. This way the “deploy to production” option wont appear if it wasnt previously deployed to Staging. Have you checked our post on the new2.6 features? https://octopusdeploy.com/blog/2.6
We’ll have documentation specifically for Lifecycles on the upcoming days. In the meantime, feel free to try out 2.6 pre-release. You can get it from here: https://octopusdeploy.com/downloads/2.6.0
Sorry it took me so long to reply. Unfortunately I didn’t get the time to look into this before but I just read the post and I think the ‘Phases’ feature of lifecycles is exactly what I want.
Thanks Dalmiro - this lifecycles feature does look pretty impressive.