Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass variable from build to release in azure build to release pipeline

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?

like image 610
Venki Avatar asked May 03 '20 15:05

Venki


People also ask

How do you pass variable from one phase to another Azure DevOps pipeline?

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"

How do you use output variables in Azure DevOps release pipeline?

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] .


1 Answers

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?

like image 122
PatrickLu-MSFT Avatar answered Sep 19 '22 16:09

PatrickLu-MSFT