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
- Missing Header (Feature Title and Toolbar) on some Feature Work Items in TFS Web Access
- Upgrading separate Project Collection Database to new TFS Version
- OpsHub Visual Studio Online Migration Utility Hangs on Creating Configuration
- The merge tool is not showing when call Workspace.ResolveConflict method in TFS 2012
- HowTo: change a project's status from `Invalid` to `Valid`?
- TFS 2013 Object reference not set to an instance of an object in Team Explorer
- Release Management for Visual Studio 2013 - Release Exception
- Visual studio 2013 team project has been deleted
- TFS version control does not show conflicts
- include typescript file in output result build with TFS
- Team Foundation 2012 not recognising changes in vb6 app
- WebDeploy from TFS using Build Definitions to IIS site containing files changed by users
- Team Foundation plugin for Android Studio
- TFS 2013 with Octopus Deploy, Email Template - Resolved Bugs/User Stories
- What is the best branching strategy in TFS to share code between multiple team projects?
Related Questions in BUILD-PIPELINE
- Copy file from NuGet package to OutDir in a project not working on Azure DevOps
- Difference between $(Rev:r) and $(Rev:.r) in BuildNumber part of Azure DevOps Build Pipelines?
- Updated file is not showing into artifact after successful completion of build pipeline in Azure Devops
- Send the Build status of an Azure DevOps Server pipeline via REST to Bitbucket
- I want to create a bug whenever my build pipeline fails in azure devops. And i want to have it configured for a particular branch
- Azure DevOps Publish Azure Function not working
- Azure Build Pipeline visual studio error while running build: access denied. Please make sure you're running the application as administrator
- Rewriting YAML file configuration during runtime in build pipeline using Powershell
- Increase Angular6 Library version automatically in DevOps
- How to trigger a task inside a job from jenkins pipeline
- Azure DevOps with self-hosted Ubuntu machine: docker fails
- Azure Devops Build Pipeline from PR Trigger get source branch
- Blazor WebAssembly Azure DevOps build pipeline publish artifacts
- Azure build agent and xamarin.android build
- Yaml trigger doesn't work but overridding in pipeline does
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 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.