Git标签在Visual Studio在线构建结束(构建vNext,托管池) [英] Git tag at the end of build on Visual Studio Online (Build vNext, hosted pool)

查看:533
本文介绍了Git标签在Visual Studio在线构建结束(构建vNext,托管池)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在VSO build vNext上构建成功时自动标记一个提交。
我已阅读包括此页面的文档



如注释中所述,这不适用于外部git存储库。


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/scripts/variables and I've setup a small PowerShell script. First of all, it seems that BUILD_REPOSITORY_AUTH_USERNAME variable (and its friend password) are empty. I guess they're only available with external gits ? Second of all, it seems that the checkout for build is done via tasks which runs LibGit2Sharp, therefore credentials are not stored in any helper.

This is my PowerShell script :

git tag $Env:BUILD_BUILDNUMBER
git status
git config -l 
git push --progress https://$Env:GITUSER:$Env:GITPASSWORD@myrepo.visualstudio.com/DefaultCollection/_git/myproject tag $Env:BUILD_BUILDNUMBER
git status
exit

It works well on my machine but on the agent (hosted pool) but it seems to hang on the agent at the push command (after 1h, it got automatically killed by the controller).

Here are the log:

******************************************************************************
Starting task: Powershell: tools/GitCommands.ps1
******************************************************************************
HEAD detached at 819e778
nothing to commit, working directory clean
core.symlinks=false
core.autocrlf=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
core.bare=false
core.filemode=false
core.symlinks=false
core.ignorecase=true
core.logallrefupdates=true
core.repositoryformatversion=0
remote.origin.url=https://myrepo.visualstudio.com/DefaultCollection/_git/myproject
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

******************************************************************************
Finishing task: PowerShell
******************************************************************************

As you can see, no log for the push nor the status command. Any idea on how to achieve this ?

解决方案

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.

这篇关于Git标签在Visual Studio在线构建结束(构建vNext,托管池)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆