In this thread the setting of a variable group variable in an Azure Devops build is discussed.
My question is if there is also a way to set the value of a variable group variable by a TFS Build.
To be concrete: I'd like to store the current value of the $(Rev:r) variable of a build pipeline in a variable group to use it in a different build pipeline.
How to set value of variable group variable in TFS Build
589 Views Asked by MatterOfFact At
1
There are 1 best solutions below
Related Questions in TFS
- Azure DevOps Server witadmin error 500 when downloading/uploading workitem XML
- How to fix a CS0281 error on build server
- Integrate Deployment status to Work Items in TFS
- How to customize data sources in the dropdown box of TFS work item templates
- How to add nuget package for offline tfs build task
- Using Azure DevOps Server 2022 (On-Premise) with Visual Studio Code for Java Project
- Ticketstatus on DynamicsCRM updates on TFS Ticketstatus change
- Limiting access to files in Github while being edited by other collaborator
- Trying to read commits from azure devops rest api results in redirects
- ADOS .NET: Exchange SOAP Methode to REST equivalent
- DevOps 2022 Server not connecting on VS 2012 and VS 2010
- TFS integration with Jenkins
- Preventing Merge and Branch your own code on TFS
- Get all users of an Ado or TFS project
- Reduce AzureDevOps aka. TFS Database size
Related Questions in BUILD-PIPELINE
- ##[warning]Directory 'D:\a\1\a' is empty. Nothing will be added to build artifact 'drop'
- Module parse failed: Unexpected token (8:39)
- Updated file is not showing into artifact after successful completion of build pipeline in Azure Devops
- Difference between $(Rev:r) and $(Rev:.r) in BuildNumber part of Azure DevOps Build Pipelines?
- When creating a YAML Azure DevOps build pipeline, should the DotNetCoreCLI tasks work for .Net Framework, ,Net Core and .Net solutions?
- How to Disable Build Validation when there is a commit to the source branch in the PR
- How to specity workspace clean for hosted agents in Azure DevOps build pipeline for Pipeline with steps and one implicit job?
- Update build number of a pipeline with respect to another pipeline
- Getting error at NPM publish stage - Your cache folder contains root-owned files
- Jenkins - Build Pipeline plugins icon not showing properly
- Error starting build - Android build failing on App Center
- Artifacts - Create. Azure DevOps REST API
- Dependencies azure devops yaml
- Azure pipeline conditions
- Why I get Out Of Memory in GC during deserialization when i do ng build in Angular 14?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
We could still use the Logging Command to set the value of a variable group variable by a TFS Build:
However, if you want store the current value of the $(Rev:r) variable of a build pipeline in a variable group to use it in a different build pipeline, there will be two problems here.
The first one is that the variable
$(Rev:r)could not be used in the command line or powershell task, since the colon:is not supported. This variable$(Rev:r)is specifically defined by Azure devops, we cannot call it outside of azure devops. So, we could not use the$(Rev:r)inside the task, like:To resolve this issue, we could set this variable
$(Rev:r)in the Build number format of Options tab in the build pipeline:Now, we could use the predefined variables
Build.BuildNumberto get the value of$(Rev:r). The variable Build.BuildNumber is supported by command line or powershell task, we could use it:Write-Host "##vso[task.setvariable variable=testvar;]$(Build.BuildNumber)"
The second question is that the variables set with the Logging Command can only be applied to the current agent environment, and will not be saved to the task group. So it could not be used to different build pipeline. It will still use the value I originally set in the taskgroup, and you could check the value in task group, it is not modified by our Logging Command.
To resolve this issue, we need use REST API to update the real value in the task group from web page:
Please check the UPDATE3 answer in this thread for the detailed steps to update the value in the task group.
So, we need use REST API and
Build.BuildNumberto achieve your request.