Azure Pipelines CI not triggering when pushing tags from Bitbucket

微笑、不失礼 提交于 2019-12-10 18:17:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!