根据输入参数的所有可能组合生成作业矩阵 [英] Generate job matrix from all possible combinations of input parameters

查看:119
本文介绍了根据输入参数的所有可能组合生成作业矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用

I would like to generate jobs in Azure Pipelines using the matrix strategy, but not by explicitly listing all possible combinations. Instead of doing:

matrix:
  core211:
    module: core
    scala: 2.11
  python211:
    module: python
    scala: 2.11
  libraries211:
    module: ibraries
    scala: 2.11
  core212:
    module: core
    scala: 2.12
  python212:
    module: python
    scala: 2.12
  libraries212:
    module: libraries
    scala: 2.12

我想做

matrix:
  combinations:
    module: ["libraries", "python", "core"]
    scala: ["2.11", "2.12"]

生成上述矩阵. 使用Azure Pipelines可以做到这一点吗?

to generate above matrix. Is this possible with Azure Pipelines?

我从 Travis CI 中获得了这种方法.

I got this approach from Travis CI.

推荐答案

Azure Pipelines是否可能?

Is this possible with Azure Pipelines?

恐怕答案是否定的.目前,这不是受支持的方案.

I'm afraid the answer is negative. For now, it's not a supported scenario.

关于yaml中的Matrix架构,请检查此文档:

About the Matrix schema in yaml please check this document:

strategy:
  matrix: { string1: { string2: string3 } }
  maxParallel: number

它等于:

    matrix:
      string1:
        string2: string3
        .
        .
        .
      string1:
        string2: string3
        .
        .
        .

根据文档: 对于矩阵中的每个string1,将生成作业的副本.字符串1是副本的名称,并将添加到作业名称之后.

因此,如果我们要生成6个作业,那么现在我们必须列出6个"string1". (这意味着我们确实需要明确列出所有可能的组合...)

So if we want to generate 6 jobs, for now we have to list 6 "string1". (It means we do need to explicitly list all possible combinations...)

此外:

除了否定答案,我认为您想要的是一个好主意!因此,我发布了功能请求 DC论坛中.任何对此感兴趣的人都可以对其进行投票并进行跟踪.希望以上所有对您有所帮助:)

Apart from the negative answer, I think what you want is a good idea! So I post a feature request here in DC forum. Anyone interested in this can vote for it and track it. Hope all above makes some help :)

这篇关于根据输入参数的所有可能组合生成作业矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆