我在线上有一个Azure DevOps,并希望将Buildnumber设置为ImageTag变量,以便稍后将其用作docker映像的Image标签。为此,我在变量标签上创建了空变量ImageTag:
并添加PS脚本:
Write-Host "Buildnumber is $(Build.BuildNumber)"
$ImageTagVar = "$(Build.BuildNumber)"
Write-Host "##vso[task.setvariable variable=ImageTag;]$ImageTagVar"
Write-Host "Set environment variable to $env:ImageTag"
Write-Host "Set environment variable1 to $ImageTag"
问题在于$(Build.BuildNumber)中的内容不会传递给变量ImageTag:
谁能暗示我,我在Azure DevOps中做错了什么?