Set a variable once for the entire Lifecycle

Hi folks!

Is there a way to set a project variable only on the deploy to the first environment in a particular lifecycle and then reuse the value of that variable throughout the rest of the lifecycle deployments? The particular use case that I have is a legacy monolithic deploy that does not use NuGet because it’s huge. As I have it configured now, there’s a “BuildNumber” variable which I use in a URL to pull a zip file over HTTP. I prompt for this variable at each deployment. But what I’d really like is for it to prompt only on the deployment to the first environment and then use that value for the rest of the lifecycle. This would prevent human error.

An alternative approach I am considering is using the fourth “octet” in the Release number (e.g. 2015.9.0.434 where 434 is the build number). But I’m not sure I like that idea as much.

Comments and suggestions welcome!

Hi,

Thanks for the question.

Your idea using the build number in the release number is not perfect but you will at least avoid potentially different builds in the same release.

We were thinking you might create a package that contains the variable or has the build as its version. You could create the package as part of your build process and push it to Octopus. Set your deployment up to include that package as a package deploy step and use the package version to pull zip files.

As an added benefit, you can use the UI to select an existing package and therefore a build that actually exists.

Would something like that work?

Cheers,
Shane

I like this solution. Thank you!