【发布时间】:2019-01-27 09:12:23
【问题描述】:
我目前正在将 VSTS 构建管道转换为 YAML build definions。但是我还没有找到在我的 YAML 文件中使用 Variable Group 变量的方法。如果我引用一个变量,就像之前在构建管道中一样,PowerShell 脚本似乎无法找到它。
- powershell: |
Write-Output Testing...
Write-Output "DatabaseName: $(AzureSqlDb_DatabaseName)"
displayName: Output Library Vars
详细错误信息如下:
AzureSqlDb_DatabaseName : The term 'AzureSqlDb_DatabaseName' 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 D:\a\_temp\e06f9ee7-8418-4339-a976-ed78a0e71021.ps1:3 char:31
+ Write-Output "DatabaseName: $(AzureSqlDb_DatabaseName)"
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (AzureSqlDb_DatabaseName:String) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : CommandNotFoundException
##[debug]Exit code: 1
##[debug]Leaving Invoke-VstsTool.
##[error]PowerShell exited with code '1'.
如您所见,我已经为构建管道启用了 system.debug。所以:
- 是否已经支持使用变量组?
- 如果是,引用这些变量的方法是什么?
【问题讨论】:
-
不使用 $(AzureSqlDb_DatabaseName),但在使用 $env:AzureSqlDb_DatabaseName 时也不起作用。虽然,在这种情况下不会出现错误。
标签: azure-devops azure-pipelines