Working with multi-tenants in Octopus, allows you to deploy releases to multiple customers. As you work with multi-tenant releases there will be variables that are common across all tenants but need a unique value per tenant, for instance, website names, titles, headers, images, logo, URLs, contact information, and technical details such as server names and database connection settings. The Variable Template feature lets you specify which variables are required to successfully deploy a project to a tenant, and then to provide those variables per tenant.
For a working example see our multi-tenant deployments guide: Working with tenant-specific variables.
Adding a variable template
- Navigate to Library ➜ Variable Sets and click ADD VARIABLE SET.
- Give the variable set a name, description, and click SAVE.
- Click Variable Templates ➜ ADD TEMPLATE.
- Add the details to your template and click SAVE:
|Name||The name of the variable template. This will also be the name given to the resulting variable value you can use in your deployment process.||
|Label||The label that will be displayed when prompting for the variable value.||Tenant alias|
|Help text||The descriptive help text that will be displayed to provide the user with enough information to accurately provide the value.||A shortened, URL friendly, version of the tenant's name.|
|Default value||The value that will be given to the variable if an actual value is not provided. The default value can contain variable binding expressions.||
|Control type||You can select one of several different data types. This controls the user interface provided to collect the variable value, and determines how the variable value is interpreted. Note the variable values will be stored and interpreted as text.||Single-line text box, Multi-line text box, Drop down, Checkbox, Sensitive/password box, Azure Account|
|Options||(Only applies when Data type: Drop down). This defines the list of options available for the user to select from the drop down list. Enter each option on a new line. Use
Which variable templates apply to each tenant?
Good question! When you connect a tenant to a project, variable templates defined by the project itself, or by included library variable sets, will be required by the tenant.
- Library variable templates will be collected once - they are considered to be constant for the tenant. Think of these like "custom fields" for your tenants.
- Project variable templates will be collected once for each project/environment combination the tenant is connected to. Think of these like database connection settings for the specific tenant/project/environment combination.
By carefully designing your variable templates you can implement complex multi-tenant deployment scenarios.
Need support? We're here to help.