Azure Pipeline每期
我发现了许多有关在Azure管道中使用每个循环的示例,但是我发现所有循环都使用参数作为数组。 使用代码中创建的数组怎么样? 我是说:
- script: COMMAND=$(npx nx affected:apps --base=$(BASE_SHA) --head=$(HEAD_SHA) --plain) && echo "##vso[task.setvariable variable=APPLICATIONS;]$COMMAND"
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo 'APPLICATIONS + $(APPLICATIONS)'
readarray -d ' ' -t ARRAYAPPS <<<'$(APPLICATIONS)'
echo ${ARRAYAPPS[0]}
echo ${ARRAYAPPS[1]}
- ${{each APPLICATION in $APPLICATIONS }}:
- task: ...
I found a lot of examples about using EACH loop in an Azure pipeline, but all of them I found are using a parameter as the array.
What about using an array that was created in the code?
I mean:
- script: COMMAND=$(npx nx affected:apps --base=$(BASE_SHA) --head=$(HEAD_SHA) --plain) && echo "##vso[task.setvariable variable=APPLICATIONS;]$COMMAND"
- task: Bash@3
inputs:
targetType: 'inline'
script: |
echo 'APPLICATIONS + $(APPLICATIONS)'
readarray -d ' ' -t ARRAYAPPS <<<'$(APPLICATIONS)'
echo ${ARRAYAPPS[0]}
echo ${ARRAYAPPS[1]}
- ${{each APPLICATION in $APPLICATIONS }}:
- task: ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
管道
$ {{每个
不支持运行时管道变量。它仅支持参数,因为在编译时评估了每个每个。当时,只有参数(以及基于它们的变量)可用。Pipeline
${{each
does not support runtime pipeline variables. It only supports parameters, because the each is evaluated at compile time; and at that time, it is only parameters (and variables based on them) that are available.“如果您以某种方式被阻止,请尝试以这种方式改变”
我修改了该方法,然后在Bash脚本中包括了循环:
"If you're blocked in a way, try to change this way"
I modified the approach, and I included the loop inside the bash script: