[英]Multi-agent jobs over versions in yaml pipeline
So, I have a yaml pipeline that has an array storing a set of versions in bash, let's say arrayVersions=(3.0.1 3.0.2 ....)
.所以,我有一个 yaml 管道,它有一个在 bash 中存储一组版本的数组,比如说
arrayVersions=(3.0.1 3.0.2 ....)
。
Now, I want to set up the pipeline that splits each of these versions in one single job in the yaml pipeline, then run them in multi-agent paradigm.现在,我想设置管道,将这些版本中的每一个拆分为 yaml 管道中的一个作业,然后在多代理范例中运行它们。
CONTEXT - I have set up the pipeline that iterates over the array and runs, however, it is very slow since it runs sequentially. CONTEXT - 我已经设置了遍历数组并运行的管道,但是,它非常慢,因为它是按顺序运行的。 So, I tried multithreaded parallel programming in bash, but it did not work out.
所以,我在 bash 中尝试了多线程并行编程,但没有成功。 In ideal solution, I am thinking to split up all the versions and run them as a new
job
in the pipeline.在理想的解决方案中,我正在考虑拆分所有版本并将它们作为管道中的新
job
运行。 It would be something like this:它会是这样的:
jobs:
# get all the versions
# split up each version into 1 single job and run the jobs in parallel
job: 3.0.1
...
job: 3.0.2
...
Is there any way I can set it up?有什么办法可以设置吗?
Have you tried using a template and calling it from the jobs
section?您是否尝试过使用模板并从
jobs
部分调用它? Here's an example:这是一个例子:
# azure-pipelines.yml
trigger:
- none
jobs:
- job: Build
steps:
- template: build-specific-version.yml
parameters:
appVersion:
- '3.0.1'
- '3.0.2'
- '3.0.3'
# build-specific-version.yml
parameters:
- name: 'appVersion'
type: object
default:
- '1.0'
- '1.1'
steps:
- ${{ each v in parameters.appVersion }}:
- script: echo ${{ v }}
Docs: Microsoft technical documentation|Template types & usage文档: Microsoft 技术文档|模板类型和用法
Also see: Loops and arrays in Azure Devops Pipelines另请参阅: Azure Devops Pipelines 中的循环和数组
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.