Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

azure devops - Is there a way to set variables in variable groups

I'm trying to share version information from different pipelines to later use them to create a release config in a release pipeline. So basically I need to share information between different pipelines.

To create a somehow unique version I want to always use the output of git rev-parse HEAD.

I've already tried to use variable groups, but I was only able to read them and not to set them. And I'm not aware of another way which is supported by azure devops, I could of course use files and publish them.

I used the example which was provided by the documentation.

#!/bin/bash
echo "##vso[task.setvariable variable=sauce]crushed tomatoes"

I expect to get a change variable in the variable group in order to read that variable later on in a release pipeline. Any help is appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Could be done via the Azure devops CLI.

Create the powershell task:

echo $env:AZURE_DEVOPS_EXT_PAT | az devops login
az devops configure -d organization=https://dev.azure.com/<your_organisation>/ project=<your_project>

az pipelines variable-group variable update --id <id_here> --name <name_here> --value <value_here>

and also create the variable in the task like so enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...