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.
Could be done via the Azure devops CLI.
Create the powershell task:
and also create the variable in the task like so
You can not change a variable in a variable group with the logging command
task.setvariable
(the logging command can change only for a specific run).The only way to update a variables in the variable group is with the Rest API:
Request body:
So you need to add a task that excute the above Rest API, for example, PowerShell:
You need to allow scripts to access the OAuth token (check the checkbox in the agent job options):
And give Administrate permissions to the build user (to the variable group):