Sometimes there isn't a built-in step template or a community step template available that does what you need. Or perhaps several of your projects have similar or identical steps. You can create your own custom step templates to reuse across your projects. You can also share them with the community.
Custom step templates can be based on a built-in or installed community step templates. These custom step templates can be reused in projects and managed in the step template library.
Creating custom step templates
To create your own step template, perform the following.
- Navigate to the Library ➜ Step Templates area and click Add.
- Select a built-in step to base your custom step template on.
- Populate the step template.
There are three parts to any step template:
- Step details.
- Additional parameters.
The Step tab is where you fill out the details of what the step will do. This tab gives you exactly the same fields as you would see if you added the step type directly to your project, so it will be the most familiar.
Any details that need to be specified at the project level can be handled using Parameters. Any parameters specified in the Parameters tab will be exposed to you as variables and can be used in the same way.
The Parameters tab allows you to specify fields that will be filled out by the users of this step.
You're required to give the parameter a variable name and label to use, as well as some optional help text and a default value.
Finally, you can choose the way the field will appear to a user with the Control type field. There are a number of options available, however keep in mind the end result will be a variable with a string value.
2019.10.0 introduced a new Package control type. This new control type allows the selection of a Feed and Package to use as part of the step to be deferred until the step template is added to a project.
Any variables you configure as Parameters will be available as variables that can be used in the Step tab of the step template.
The Settings tab allows you to give your step a name and optional description.
After saving your step, you'll notice another tab called Usage. This tab shows where the step is being used and whether the version being used is current or a previous version.
You'll also see a handy counter next to the Usage tab so you can see at a glance how many projects are out-of-date.
Custom step templates inherit their logo from the template that was used to create them. This means that most of them will share the same logo. Fortunately this can be easily changed and each custom template can have its own unique logo. To do that navigate to the Settings tab and upload a custom logo from there.
Export your custom step template
If you want to transport, backup, or share your custom step templates with the community, you can export a template by finding your template in Library ➜ Step Templates, and clicking the Export link.
Now you can take that exported template document and commit it to source control, or share it on the Community Library.
Linking custom step templates to community step templates
Once a day Octopus retrieves the latest step templates from the Community Library. At the end of that process it also tries to link the community step templates to the any existing custom templates that have been imported manually in the past. Once the link is established the custom template can receive updates directly from the Community Library. If all the properties except the version property match the custom step template and the community step template will be linked.
If the linking process isn't linking a template that you believe should be linked then more than likely you don't have the very latest version of the template. The easiest way to fix this problem is to manually update the template with the data from the Community Library.
Running script based custom step templates
Octopus 3.7 introduced the ability to run script based custom step templates on a group of machines. This can be very handy to execute script based step templates to test them before starting to use them in your projects as well as performing regular admin or operations functions. This should be familiar to people who have used the script console in the past.
It's important to note that you can only run script based custom step templates. It's not currently possible to execute step templates based on other step types.
To run a script based step template, perform the following.
Navigate to Library ➜ Step Templates area and click the Run button next to the script based custom step template or alternately, select a script template and click the Run button from the template editor page:
Select a group of targets to run the step on. This can be done by target name or by environments and roles:
Enter any required parameters:
Click the Run now button. This will execute the step as a new task and provide the full script:
To re-run the script against different deployment targets or modify the input parameters, simply click the Modify and re-run button.
Common step properties
All steps have a name, which is used to identify the step.
Be careful when changing names! Octopus commonly uses names as a convenient identity or handle to things, and the steps and actions in a deployment process are special in that way. For example you can use output variables to chain steps together, and you use the name as the indexer for the output variable. For example:
Need support? We're here to help.