In my use of Octopus Deploy I have many projects which are mostly the same as each other, but also differ a little here and there. It isn’t a ‘Tenant’ based deployment, so Variable Templates are not useable - but I feel I want something similar so that is if I wanted to include ‘component X’ in my projects, which may include multiple steps - I would like to be able to bring in all the variables that component is going to need to support both the Steps and any underlying variable substitutions.
Ideally I could create a ‘template project’ which would have the Steps for that ‘component’ - and when brought in I can place those Steps in different places within my existing parent projects and know all the supporting variables exist. I would like to override some of the values as sometimes not all deployments want the same values.
The closest I can get to this is having a separate Project altogether and calling this from the parent project, but I dont particularly like this as it spinds off multiple Tasks and generally admin becomes more difficult.
Does anyone have any suggestions for ‘variable’ and/or step re-use across projects? Ideally versioned as I wouldn’t want the copies to become out of date but equally wouldn’t want any change to automatically affect all projects until those projects want the change.
Thanks for your question!
I can think of two solutions that might get you most of the way there, but there isn’t this specific functionality in Octopus.
Create a step template for each of the steps in the component and create a parameter for each value that can be a variable. The parameters can have default values that can be overridden by each consumer of the step.
This also works with the idea of versioning because changes to the step template are versioned and you have to update the existing projects to use the new version.
Unfortunately, there isn’t a way to tie these steps together, so you would need to create and include multiple steps per component.
Library Variable Sets
Another idea would be to create a library variable set per component. When you have a project using a component, you would include that variable set into the project.
You can override the variables in the library set by creating a project level variable with the same name. For example, if you have a library variable set ComponentX with a variable named ComponentX.Database.Server with a default value of “databaseServer”, that is the value the project will use unless it also defines a variable named “ComponentX.Database.Server” with a different value.
The downside to this approach is that there is no built-in versioning for changes to the variable set. You could potentially do some sort of versioning by creating a variable set per version or somehow incorporating the version in the variable name, but this could become difficult to manage if you are making a lot of changes to the variables.
I hope that helps - let me know if you have any other questions.
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.