Big*_*ney 2 powershell azure-devops
我有一个 Azure Devops 构建 YAML 文件,其中包含以下任务:
- task: PowerShell@2
displayName: 'Set coverage variable'
inputs:
targetType: 'inline'
script: Write-Host "##vso[task.setvariable variable=coverage]Get-Content .\coverage\lcov-report\summary.txt"
Run Code Online (Sandbox Code Playgroud)
我希望此任务将变量设置coverage为 的内容的值summary.txt。但是,当在以下任务中访问变量时,我看到该变量实际上是 string Get-Content .\coverage\lcov-report\summary.txt。
文档中似乎没有任何关于如何实现这一点的示例。这只是脚本的限制吗?我是否必须将Get-Content命令设置为变量然后访问该变量?
小智 5
请在]之后使用$()。
例子:
##vso[task.setvariable variable=coverage]$(Get-Content .\coverage\lcov-report\summary.txt)"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2767 次 |
| 最近记录: |