2

Azure DevOps is now warning that all variables which may be settable at the time of queueing must be declared in the pipeline as settable at queue time. This page shows how to do that with the Pipeline UI editor. However, there is no explanation how it is done in the YAML source file.

Hence the question: How to define queue time variables in Azure DevOps YAML?

3 Answers 3

2

In YAML you can achieve it using runtime parameters instead of variable

enter image description here

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters?view=azure-devops&tabs=script

Sign up to request clarification or add additional context in comments.

Comments

2

How to define queue time variables in Azure DevOps YAML?

You can define the queue time variable in YAML Pipeline Variable UI page instead of YAML code.

enter image description here

Then you can define the variables in Variables option and enable the option: Let users override this value when running this pipeline

For example:

enter image description here

In this case, you can modify the variable at queue time.

Comments

0

Since I am reusing the same pipeline YAML file in many projects, I need a method which does not require unnecessary GUI interaction when creating the pipeline.

Luckily, it is possible and the second link in the answer of Kontekst describes this. For convenience, I am providing an example here as well. The following

parameters:
- name: BuildType
  displayName: Build type
  type: string
  default: development
  values:
  - experimental
  - development
  - release

When starting the pipeline from the DevOps GUI, the above definitions will cause that the variable display name ("Build type") is displayed with a bullet selection where the value can be chosen. The default (in this case "development") will be selected initially.

If the pipeline if started automatically (a commit trigger), then the defined variables will have their default values.

The value of parameters is accessed in the pipeline like normal pipeline variables, i.e. in this case by $(BuildType).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.