jenkins-pipeline - 如何访问标签中轴的值?
问题描述
...
matrix {
axes {
axis {
name 'FOO'
values 'foo1' 'foo2' //
}
... stages {
stage ('doIt') {
agent{
label '???'
}
...
我想建立一个指令,如果也找到 FOO 的值之一label
,它将接受win
或。mac
如何将轴的值与其他字符串组合以形成有意义的标签?
解决方案
您可以通过名称访问轴变量 - FOO
。您唯一需要记住的是在双引号字符串中使用它,以便可以正确插入该值。
pipeline {
agent none
stages {
stage('Matrix example') {
matrix {
agent any
axes {
axis {
name 'FOO'
values 'bar1', 'bar2', 'bar3'
}
}
stages {
stage('Test') {
agent {
label "${FOO}"
}
steps {
// ...
}
}
}
}
}
}
}
推荐阅读
- css - CSS GRID 无法按顺序重新排列项目:;
- visual-studio - 安装 SQLite NuGet 包会安装包,但参考不可用。VS2019 社区
- r - 有没有一种简单的方法可以在不使用 dplyr::select() 的情况下订购大量列?
- javascript - 使用 $.ajax 向服务器请求不返回成功 - PHP
- python - Keras compile() 函数需要很长时间才能使用自定义损失函数
- php - Prepared statements, SQLSTATE[HY093]: Invalid parameter number
- instance - gcloud 对连接到实例的所有磁盘进行快照
- c++ - 用真值填充向量
- c# - WPF 分隔符背景颜色保持灰色
- php - WP Woocommerce 结帐页面。更改“下订单”按钮以通过电子邮件发送结帐表格