多个矩阵选项的Azure DevOps管道交叉产品
Azure Devops管道文档提供了使用矩阵
构建两个不同的OS和版本组合的示例:
strategy:
matrix:
jdk10_linux:
imageName: "ubuntu-latest"
jdkVersion: "1.10"
jdk11_windows:
imageName: "windows-latest"
jdkVersion: "1.11"
请参见在这里
问题:有没有办法获得多组矩阵选项的交叉产品。假设我想要这个:
strategy:
matrix:
jdk10_linux:
imageName: "ubuntu-latest"
jdkVersion: "1.10"
jdk11_linux:
imageName: "ubuntu-latest"
jdkVersion: "1.11"
jdk10_windows:
imageName: "windows-latest"
jdkVersion: "1.10"
jdk11_windows:
imageName: "windows-latest"
jdkVersion: "1.11"
除了复制并粘贴整个列表外,还有一种清洁/更简单的方法吗?
从逻辑上讲,我希望能够说更多的话:
imageList: ['windows-latest', 'ubuntu-latest']
jdkList: ['1.10', '1.11']
optionList: ['a','b','c']
strategy:
matrix_combine_lists:
imageName: imageList
jdkVersion: jdkList
someOption: optionList
The Azure DevOps pipeline documentation provides an example of using matrix
to build two different OS and version combinations:
strategy:
matrix:
jdk10_linux:
imageName: "ubuntu-latest"
jdkVersion: "1.10"
jdk11_windows:
imageName: "windows-latest"
jdkVersion: "1.11"
see here
Question: Is there a way to get a cross-product of multiple sets of matrix options. Suppose for example, I want this:
strategy:
matrix:
jdk10_linux:
imageName: "ubuntu-latest"
jdkVersion: "1.10"
jdk11_linux:
imageName: "ubuntu-latest"
jdkVersion: "1.11"
jdk10_windows:
imageName: "windows-latest"
jdkVersion: "1.10"
jdk11_windows:
imageName: "windows-latest"
jdkVersion: "1.11"
Is there a cleaner/easier way to do this besides copy and paste the entire list?
Logically, I'd like to be able to say something more like:
imageList: ['windows-latest', 'ubuntu-latest']
jdkList: ['1.10', '1.11']
optionList: ['a','b','c']
strategy:
matrix_combine_lists:
imageName: imageList
jdkVersion: jdkList
someOption: optionList
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定是否可以使用矩阵,但是矩阵只是与另一组参数并行运行作业,因此使用每个模板表达式也应该工作:
I am not sure if it is possible using matrix but matrix is just about running jobs in parallel with a different set of parameters so using Each Template Expression should work as well: