简体   繁体   English

yaml管道中版本的多代理作业

[英]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.

相关问题 如何将多文档 YAML 文件迭代到 pipe 到命令? - How to iterate over a multi-document YAML file to pipe to a command? 在 gitlab yaml 管道内循环 - while loop inside gitlab yaml pipeline 如何遍历参数列表并提交作业? - How to loop over a parameter list and submit jobs? 如何在 Jenkins 非管道作业中使用秘密文件 - How to use the secret file in a Jenkins Non Pipeline Jobs azure devops yaml 管道中无法识别来自变量组的变量 - Variables from variable group are not recognized in azure devops yaml pipeline 等待 bash 中的作业,一次允许有限的并行作业,然后让所有人完成继续使用管道的 rest - waiting on jobs in bash, allowing for a limited parallel jobs at one time, and then for all to finish to continue with the rest of the pipeline 带有多管道的Net :: OpenSSH命令远程 - Net::OpenSSH command remote with multi pipeline 从bash中的管道迭代文件名 - Iterating over filenames from a pipeline in bash 使用 sed 将 yaml 文件中的值替换为多行字符串 - Replace a value in yaml file with multi line string using sed 如何使用 curl 请求使用 CLI 从 yaml 文件创建 Azure 管道? - How do I use curl request to create an Azure Pipeline from yaml file using the CLI?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM