Nat*_*and 12 git powershell continuous-integration alm azure-devops
我想在VSO build vNext上构建成功时自动标记提交.我已经阅读了包含此页面的文档https://msdn.microsoft.com/Library/vs/alm/Build/scripts/variables,我已经设置了一个小的PowerShell脚本.首先,似乎BUILD_REPOSITORY_AUTH_USERNAME变量(及其朋友密码)为空.我猜它们只适用于外部gits?其次,似乎通过运行LibGit2Sharp的任务完成构建检查,因此凭据不会存储在任何帮助程序中.
这是我的PowerShell脚本:
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
Run Code Online (Sandbox Code Playgroud)
它在我的机器上运行良好但在代理程序(托管池)上运行良好但它似乎在push命令上挂起代理程序(1小时后,它被控制器自动杀死).
这是日志:
******************************************************************************
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
******************************************************************************
Run Code Online (Sandbox Code Playgroud)
如您所见,push和status命令都没有日志.有关如何实现这一点的任何想法?
回答问题(或更好的问题标题).只需让vNext构建就可以了.
正如评论中所提到的,这不适用于外部git存储库.