【发布时间】:2020-06-21 12:50:39
【问题描述】:
我可以在任务中获取新的字符串变量 但是如果这个新变量中有环境变量,就会失败 我需要在任务中使用 curl 来组合 API 和环境变量以获取新变量。
For Simple Example
//get string variable in task it work
- task: Bash@3
displayName: foovariable
inputs:
targetType: 'inline'
script: |
FOO="FOOTEST"
echo "##vso[task.setvariable variable=FOO]$FOO"
- task: Bash@3
displayName: echofoo
inputs:
targetType: 'inline'
script: |
echo "$(FOO)"
//print FOOTEST
//string with variables in new variables then it will fail
variables:
NAME: Eddy
steps:
- task: Bash@3
displayName: foovariable
inputs:
targetType: 'inline'
script: |
Hello="Hi $(NAME)"
echo "##vso[task.setvariable variable=HELLO]$HELLO"
- task: Bash@3
displayName: echofoo
inputs:
targetType: 'inline'
script: |
echo "$(Hello)"
//I Need it to show "Hi Eddy"
请帮我修改语法 谢谢
【问题讨论】:
标签: azure-devops yaml azure-pipelines pipeline