【发布时间】:2015-08-30 02:57:42
【问题描述】:
我想在 VSO 构建 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
它在我的机器上运行良好,但在代理(托管池)上,但它似乎在推送命令时挂在代理上(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
******************************************************************************
如您所见,推送和状态命令都没有日志。 关于如何实现这一目标的任何想法?
【问题讨论】:
-
似乎没有环境变量 BUILD_REPOSITORY_AUTH_USERNAME 了。所以如何授权进入git是一个大问题。
标签: git powershell continuous-integration azure-devops alm