How can we improve Azure DevOps?

Trigger build when pushing tag to git

This suggestion is migrated to Developer Community. Please use below link to view the current status.
https://developercommunity.visualstudio.com/content/idea/365545/trigger-build-when-pushing-tag-to-git.html
Currently it is possible to trigger a build when pushing commits to branches, but it is not possible to trigger a build when pushing tags.

53 votes
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)

We’ll send you updates on this idea

David Perfors shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

25 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Wade Chandler commented  ·   ·  Flag as inappropriate

    1) I can confirm that this works 2019-02-04 Azure DevOps, and wanted to be sure the proper info is presented here if somebody sees it (both tags created in ADO UI and git CLI and pushed):

    trigger:
    - master
    - refs/tags/*

    2) I have seen some posting /refs/tags or /refs/X ... try that with your git CLI ... git checkout /refs/tags/1.0.0 (or some real tag name) ... it will fail. It is refs/tags/X ... no prefix "/"

    3) I have not tried the other syntax yet, but there is the list syntax, that I'm using, and then a full syntax with include patterns etc here https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema?view=azure-devops&tabs=schema#trigger

  • Anonymous commented  ·   ·  Flag as inappropriate

    After struggling with this issue for a while I have found that you can trigger specific tags by leaving the wildcard at the end of the tag, so for example "refs/tags/rc-*" will trigger on all tags starting with 'rc-'. Setting it to "refs/tags/*-rc" will not work

  • Anonymous commented  ·   ·  Flag as inappropriate

    @Iliya Vasilyev:
    "However, when I specify "refs/tags/*-rc*" in "Branch filters" the build is not triggered."

    Same problem. Can't trigger any builds with any tag filter other then "*"

  • Ilya Vasilyev commented  ·   ·  Flag as inappropriate

    UPDATE: the issue with "only to the head commit of the branch" was on my side. Actually it triggers the build with tag added to any commit

  • Ilya Vasilyev commented  ·   ·  Flag as inappropriate

    refs/tags/* in "Branch filters" runs the build when tag is pushed (however only when head commit is tagged. If I create tag for some commit in the middle of "view history" - build is not started).

    But I'd like to specify "refs/tags/*-rc*" for my Release build, so QA env is redeployed only when 1.1.0-rc1 tag is pushed. I don't want my QA env is redeployed when 1.1.0 is pushed on /master branch.

    However, when I specify "refs/tags/*-rc*" in "Branch filters" the build is not triggered.

    Did anybody try more complicated filter than "refs/tags/*" ?
    @John D. Shkolnik did you manage to get the thing working?

  • Anonymous commented  ·   ·  Flag as inappropriate

    I can get builds to trigger on tag creation but I see the same "Expected a Commit, but objectId <id> resolved to a Tag" as others are seeing.

    After playing around a bit more I managed to narrow this down a bit more and builds now succeed if I don't include a tag message. As soon as I include a tag message the build once again fails as above. A fix for this would be appreciated.

  • Ilya Chudin commented  ·   ·  Flag as inappropriate

    It trigers now by filter "refs/tags/*", but chekout tag as new branch "tags/1.2.0" and git versioning is broken, because it is not a master branch.

  • Ilya Chudin commented  ·   ·  Flag as inappropriate

    Have same issues as @Jaykul descibed. Without this feature i can't move my CI process to VSTS.

  • Istvan Darvas commented  ·   ·  Flag as inappropriate

    Hi Guys!

    Is this working with .vsts-ci.yml ? I have set the branch filter for "refs/tags/*" and I got this error: "Expected a Commit, but objectId <something> resolved to a Tag"

    Yes it is a tag :) because i would like to trigger for that...

    Can you please show me a documentation or reference or howto where I can find something to solve this?

    Thanks,
    Darvi

  • Jaykul commented  ·   ·  Flag as inappropriate

    We're using VSTS git repos
    if I put /refs/head/* or /refs/tags/* (or both) it doesn't trigger at all.
    if I put * (just the star) in a trigger, it builds on commits to any branch

    -- I think they're prefixing whatever goes in the trigger fields with "/refs/head/"

  • Tugberk commented  ·   ·  Flag as inappropriate

    This is very surprising that I cannot trigger a build by pushing a git tag. This is majorly affecting my move to VSTS.

  • Tanner Watson commented  ·   ·  Flag as inappropriate

    I'm experiencing the same issue today with visualstudio.com. CI trigger is set to "refs/tags/*" but the build errors out with "Expected a Commit, but objectId HASH resolved to a Tag".

    Any suggestions?

  • Anonymous commented  ·   ·  Flag as inappropriate

    It's not working for me neither with the new interface, I've got a "Expected a Commit, but objectId _commit id_ resolved to a Tag"

  • John D. Shkolnik commented  ·   ·  Flag as inappropriate

    I'm also unable to get it to work. I added a trigger for "/refs/tags/*-rtm", added a tag as "0.4.0-rtm", pushed it, and nothing. I tried with a simpler trigger and still nothing.

← Previous 1

Feedback and Knowledge Base