3
votes

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.enter image description here

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.

enter image description here

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!

2

2 Answers

3
votes

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...

0
votes

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 image description here

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

enter image description here

Click the "Draft new release"

enter image description here

Enter the details for your release.

Pipeline picked up the new tag, and builds it

enter image description here