我可以在任务中获取新的字符串变量 但是,如果此新变量中包含环境变量,它将失败 我需要在任务中使用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"
请帮助我修改语法 谢谢
答案 0 :(得分:0)