azure-pipelines

How to specify a tag when running build pipeline?


Suppose we have a master branch, with tags like v1.0, v1.2, etc. Do I just need to type refs/tags/v1.0?

If so, I don't understand: how does Azure Pipelines know what branch to look in then? Or should it be like master/refs/tags/v1.0?

Here is the Azure Pipelines dialogue box:

Azure Pipelines dialogue box


Solution

  • For example, create a new branch test based of master->open branch test and add tag at the first commit, switch the branch to master, we will also see the same tag in the master.

    In the Azure DevOps, Tags are created based on the commit id, and a commit or tag can belong more than one branches. Check this ticket.

    We need enter refs/tags/v1.0 instead of master/refs/tags/v1.0 or select the tag in the tab page, check the pic below.

    enter image description here

    Uodate1

    Check the gif, I add the tag test in the master branch, then switch to commit page, we could see the tag in the master branch.

    Create branch test and switch to commit page, we could also see the tag in the test branch.

    enter image description here

    Result: The tag is based on commit instead of branch.

    In the git, Tags are created based on the commit id, and a commit or tag can belong more than one branches. Let’s illustrate by below graph:

    A---B---E---F master
         \     
          C---D   test
    

    This is a branch structure with master and test branch. and both branch test and master have the commit B, when we create tag in the B commit, both branch test and master have the tag.

    Then I run the pipeline via the tag

    Run the pipeline via master/refs/tags/test

    enter image description here

    Run the pipeline via refs/tags/test

    enter image description here