Git tag at the end of build on Visual Studio Online (Build vNext, hosted pool)

前端 未结 2 726
甜味超标
甜味超标 2021-02-19 20:47

I\'d like to automatically tag a commit when a build is successful on VSO build vNext. I\'ve read the doc including this page https://msdn.microsoft.com/Library/vs/alm/Build/scr

相关标签:
2条回答
  • 2021-02-19 21:22

    I'm answering myself on what I was trying to do (git tag was one of the few tasks I wanted to do). It's now possible to execute git commands in scripts. The documentation is here : https://www.visualstudio.com/en-us/docs/build/scripts/git-commands

    Here is the howto:

    Enable scripts to run Git commands

    Grant version control permissions to the build service:

    • Go to the Version Control control panel tab ▼
    • On the Version Control tab, select the repository in which you want to run Git commands, and then select Project Collection Build Service.
    • Grant permissions needed for the Git commands you want to run.

    Typically you'll want to grant:

    • Branch creation: Allow
    • Contribute: Allow
    • Read: Inherited allow
    • Tag creation: Inherited allow

    When you're done granting the permissions, make sure to click Save changes.

    Enable your build definition to run Git.exe

    On the variables tab set this variable: system.prefergit to true

    On the options tab select Allow scripts to access OAuth token.

    0 讨论(0)
  • 2021-02-19 21:29

    To answer the question (or better the title of the question). Just let the vNext build do it.

    As mentioned in the comments, this is not available for external git repositories.

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