It appears that the Runtime Parameters of Azure DevOps Pipelines has rolled out to most organisations. As such I thought it important that the Pipeline Templates are updated to use strongly typed boolean parameters. For example in the following YAML taken from the Windows Build template has a parameter, build_windows_enabled, which is typed as a boolean.
parameters: # stage_name - (Optional) The name of the stage, so that it can be referenced elsewhere (eg for dependsOn property). # Defaults to 'Build_Windows' - name: stage_name type: string default: 'Build_Windows' # build_windows_enabled - (Optional) Whether this stages should be executed. Note that setting this to false won't completely # cancel the stage, it will merely skip most of the stages. The stage will appear to complete successfully, so # any stages that depend on this stage will attempt to execute - name: build_windows_enabled type: boolean default: true
Previously, the parameters were passed in using variables defined in the main pipeline. The issue with this is that all variables are strings, so there’s no checking that a valid value has been passed in. For example:
Now we have the option of defining runtime parameters. These are parameters that are defined in the main pipeline yml file (ie not in a template). In the following example there are three runtime parameters defined; all boolean; all with a default value of true.
When we manually run this pipeline we’re now presented with a user interface that allows the user to adjust these runtime parameters, before hitting Run.
Another useful feature in the Run dialog is the Resources section
The Resources section lists referenced templates.
Clicking through on a template allows the user to adjust what version of the template to use. This is particularly useful if you are testing a new version of a template because you can Run a build referencing a different version, without making (and committing) a change to the actual pipeline.
Pipeline Templates v0.6.0
Here’s a summary of what’s in release v0.6.0:
- build-xamarin-[iOS/android/windows].yml and deploy-appcenter.yml – XXX_enabled parameter (eg windows_enabled or deploy_enabled) are now strongly typed as boolean parameters. This means you need to supply either a literal value (eg true or false) or a parameter. Use runtime parameters instead of pipeline variables to ensure values are strongly typed as boolean.