11

I searched all the docs about Output Variables are for build pipeline and only told me how to set in .yaml. But how to use it in release pipeline?

Supposed I have 2 variables $abc="123" $def="456" in step Login. How to set them in below text box? and How to use them in step Deploy? enter image description here

3
  • That is explained in the docs as well (learn.microsoft.com/en-us/azure/devops/pipelines/process/…) . You might have missed that there is a tab "Classic" next to "Yaml" Commented Dec 17, 2019 at 7:57
  • I read the link. But I still don't understand. The first sentence is "Some tasks define output variables". But how to define output variables in the task Login as my question described? Commented Dec 17, 2019 at 8:00
  • 1
    You don't set them in the textbox. The variables can only be defined in a custom task manifest. If you use a script task you can still set an output task, but there is no way to see them in the UI. You can rely set the reference part in the UI. Commented Dec 17, 2019 at 9:55

1 Answer 1

15

Some tasks define output variables

For brief text, it represents the follow scripts:

echo "##vso[task.setvariable variable=abc;isOutput=true]123"

Just specify the reference name in the blank of task, and then, you can call this output variable abc by using the format: <reference name>.<variable name>.

For example, if you specify the reference name as mycustom, just call the output variable by using $(mycustom.abc).

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

8 Comments

Is it possible to use output variables in different agent within same pipeline?
@sree1611, you are using pipeline with YAML or classic UI? If is YAML, yes , you can. If classic UI, I'm afraid you can not. You must add the output variable as a environment variable by using script, then other agents can able to access it.
Hope Release pipeline doesn't support YAML. Can you provide some example how to set environment variables ?
Environment variables are only getting updated when the release pipeline is completed. I want to use the updated variables in the same job in a different agent.
@sree1611 You could look at this answer which about how to set environment variable during the pipeline execution: stackoverflow.com/a/59357743/11508165 Let me know is it help for you:-)
|

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.