1
在我的Visual Studio Team Services构建中,我正在从一个bitbucket库中提取内容。我正在尝试获取提交消息并在PowerShell脚本中使用它。VSTS缺少某些构建标志:env:BUILD_SOURCEVERSIONMESSAGE
在我的powershell脚本中,我有以下代码。
param (
##Expect to be passed parameter $(Build.SOURCEVERSIONMESSAGE)
[string]$commitMessage = ""
)
Write-Warning "Source Message: $commitMessage"
Write-Warning "SOURCEVERSIONMESSAGE: $env:Build_SOURCEVERSIONMESSAGE"
Get-ChildItem Env:
使我有以下错误:
2017-08-24T02:18:27.0938681Z ##[command]. 'd:\a\1\s\Pcmtec.Azure\DeploymentScripts\SetBuildTagTest.ps1' -commitMessage $(Build.SOURCEVERSIONMESSAGE)
2017-08-24T02:18:30.3970727Z ##[error]Build.SOURCEVERSIONMESSAGE : The term 'Build.SOURCEVERSIONMESSAGE' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:1 char:82
+ ... pts\SetBuildTagTest.ps1' -commitMessage $(Build.SOURCEVERSIONMESSAGE)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Build.SOURCEVERSIONMESSAGE:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
2017-08-24T02:18:30.4020718Z WARNING: Source Message:
2017-08-24T02:18:30.4020718Z WARNING: SOURCEVERSIONMESSAGE:
它然后打印出所有的ENV变量。我唯一得到的是:
BUILD_ARTIFACTSTAGINGDIRECTORY
BUILD_BINARIESDIRECTORY
BUILD_BUILDID
BUILD_BUILDNUMBER
BUILD_BUILDURI
BUILD_CONTAINERID
BUILD_DEFINITIONNAME
BUILD_DEFINITIONVERSION
BUILD_QUEUEDBY
BUILD_QUEUEDBYID
BUILD_REASON
BUILD_REPOSITORY_CLEAN
BUILD_REPOSITORY_GIT_SUBMOD...
BUILD_REPOSITORY_ID
BUILD_REPOSITORY_LOCALPATH
BUILD_REPOSITORY_NAME
BUILD_REPOSITORY_PROVIDER
BUILD_REPOSITORY_URI
BUILD_REQUESTEDFOR
BUILD_REQUESTEDFOREMAIL
BUILD_REQUESTEDFORID
BUILD_SOURCEBRANCH
BUILD_SOURCEBRANCHNAME
BUILD_SOURCESDIRECTORY
BUILD_SOURCEVERSION
BUILD_STAGINGDIRECTORY
BUILDCONFIGURATION
BUILD_SOURCEVERSIONMESSAGE为什么缺失?
“git log head -1”做了诡计。谢谢。 – rolls