How to pass variable from build to release in azure build to release pipeline: We have variable in CI pipeline --> we have to pass that variable in Release pipeline--> that variable has to set in another yaml file. is this possible?
Passing variables between tasks in the same job In a script task, you need to print a special value to STDOUT that will be captured by Azure Pipelines to set the variable. For example, to pass the variable FOO between scripts: Set the value with the command echo "##vso[task. setvariable variable=FOO]some value"
Once the output variables are defined, you can then reference them just like any other pipeline variable. One of the most common methods is using macro syntax. To reference the foo variable defined above, for example, you could use $(foo) or in the form of [originating_task name]_[variable name] .
For now, we could only set a variable in a variable group as a static value and use it in both build and release.
Detail ways please refer Marina's answer in this question: VSTS : Can I access the Build variables from Release definition?
But according to your description, what you want is to set the variable during the build and then use it in the release pipeline.
The is no official way to pass variables follow this. As a workaround, you could use some 3rd-partly extension, store the values in a file (json, xml, yaml, what have you) and attach that as a Build Artifact. That way you can read the file in the release and set the variable again.
Take a look at this similar issue: How to get the variable value in TFS/AzureDevOps from Build to Release Pipeline?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With