Reputation: 23
I have a multi-stage pipeline that is building multiple applications. I generate a common tag once per pipeline run. How do I have the pipeline update each source commit with the same tag? Using the UI tagging options causes it to only update the source repo that contains the YAML pipeline file and not any of the additional sources.
Upvotes: 2
Views: 4611
Reputation: 1
When using this approach the tags will be removed when the build is removed. So if you don't retain your builds, the tag will disappear.
Upvotes: 0
Reputation: 1884
Citing Brady White's response from https://developercommunity.visualstudio.com/t/missing-gui-option-create-git-tag-after-successful/1007477:
Upvotes: 2
Reputation: 5242
How do I have the pipeline update each source commit with the same tag?
You can use git commands to create same labels and add them to every repositories.
Here is the script:
- task: CmdLine@2
inputs:
script: |
git tag -a {tag} -m "{tag description}"
git push origin --tags
If you only checkout one repository in a stage, you can add this task to the stages.
If you chekout more than one repository in a stage, switch to the corresponding directory before add the tag:
- task: CmdLine@2
inputs:
script: |
cd {repository A}
git tag -a {tag} -m "{tag description}"
git push origin --tags
cd ..
cd {repository B}
git tag -a {tag} -m "{tag description}"
git push origin --tags
...
Add these tasks to all stages and you will find that the latest commits from all the repositories will be tagged.
Upvotes: 2