问题
I'm trying to do a proof of concept to redesign my CI/CD pipelines in Azure Pipelines (formerly known as VSTS). My codebase is in BitBucket.
I need a continuous integration build to be triggered when I push git tags to the remote repo.
The proof of concept works really well when I use Azure Repos (VSTS), it detects a change in the "branch" "refs/tags/current" and triggers the build.
But once I switch to BitBucket, it just doesn't work, no build is triggered.
So my question is:
How can I trigger a CI build in Azure Pipelines (VSTS) when pushing tags to my BitBucket repo?
Thanks!
回答1:
No, we cannot achieve that for the service connection endpoints (BitBucket
here) , CI only works when you push commits with new changes (The real file/code changes).
But push git tags only added tags to a commit, no any other new file changes be pushed to the remote repo.
So, if you want to trigger the CI build by pushing tags only, then it will not work...
I can think of is that you can add a insignificant file in source control (a *.txt
file for example). Then edit/modify the file every time when you push tags. After finishing push tags, you need to push the new changes for the *.txt
file, but it will generate a new commit...not the commit you added tags for it...
回答2:
I got it to work by doing the following steps (This is using Github, though).
Go to the triggers for your pipeline in Azure DevOps:
Enter two branch specifications:
- refs/tags/*
- releases/*
PS: These needs to match whereever your repo hosting provider archives releases and tags.
Click Save (not Save & Queue)
Create a new tag on Github
Click the "Draft new release"
Enter the details for your release.
Pipeline picked up the new tag, and builds it
来源:https://stackoverflow.com/questions/52373011/azure-pipelines-ci-not-triggering-when-pushing-tags-from-bitbucket