YAML管道中版本的多代理工作

发布于 2025-02-01 13:59:33 字数 708 浏览 5 评论 0原文

因此,我有一个YAML管道,该管道有一个阵列存储在Bash中的版本,可以说 arrayversions =(3.0.1 3.0.2 ....)

现在,我想设置将这些版本分配为一个单个 job 在yaml管道中,然后在多代理范式中运行它们。

上下文 - 我已经设置了在数组上迭代并运行的管道,但是,由于它依次运行,因此非常慢。因此,我尝试了BASH中的多线程并行编程,但没有解决。在理想的解决方案中,我想将所有版本分开,并将它们作为新的作业运行。会这样:

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
    ...

有什么办法可以设置它?

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 ....).

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.

CONTEXT -
I have set up the pipeline that iterates over the array and runs, however, it is very slow since it runs sequentially. So, I tried multithreaded parallel programming in bash, but it did not work out. In ideal solution, I am thinking to split up all the versions and run them as a new job in the pipeline. 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱的那么颓废 2025-02-08 13:59:33

您是否尝试过使用模板并从作业部分调用它?以下是一个示例:

# 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技术文档|模板类型&用法

另请参阅: loops and Arays and Arrays in Azure DevOps Pipelines

Have you tried using a template and calling it from the jobs section? 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

Also see: Loops and arrays in Azure Devops Pipelines

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文