How to trigger VSTS build and release when pushing tags?

后端 未结 2 874
死守一世寂寞
死守一世寂寞 2020-12-08 08:16

I have rather simple scenarion, one master branch then when I want to do a production release I want to tag a commit with eg. vX.X.X.

The CI/CD pipeline looks like t

相关标签:
2条回答
  • 2020-12-08 08:45

    In many screenshots for Release artifact filters, I see the option for Build Branch; however, in our setup I don't see that. It's even there when looking at the DevOps documentation. Perhaps it's an issue of permission or version??

    We are using TFVC.

    Screenshot of Release Trigger

    0 讨论(0)
  • 2020-12-08 08:48

    When commit with tag pushed to master branch, build will be triggered for twice (on master branch and the tag) separately, you need to specify the Production Environment triggered after release not after Staging Environment.

    And the build and release definitions settings as below:

    Build definition:

    In Triggers Tab -> set branch filter to include master and refs/tags/v* ->Save.

    Release definition:

    Specify Artifact filter to include master branch for Staging Environment -> select After release for Production Environment trigger -> specify Artifact filter to include refs/tags/v* for Production Environment -> Save.

    If only commits are pushed to master branch -> a build is triggered for master branch -> a new release is created -> only deploy Staging Environment.

    If both commits and tags are pushed to master branch -> two builds are triggered (one for master branch, the other for refs/tags/v*) -> two releases are created:

    • For the release linked with build artifacts on master branch -> only Staging Environment is deployed;

    • For the release linked with build artifacts on refs/tags/v* -> only Product Environment is deployed.

    0 讨论(0)
提交回复
热议问题