小编tha*_*lya的帖子

具有动态矩阵轴值的声明式管道

嗨,我正在尝试进行 Jenknis-Declarative-Pipeline-Job 工作。

用例应该非常简单:
我想使用相同的 Jenkins 管道构建多个插件。为此,我编写了一个带有插件可以用于参数的接口的“JenkinsLibrary”。此参数之一是轴值。

遇到的问题与这篇 reddist 帖子非常相似。

我想从变量设置矩阵构建的“轴”的“值”。我没有想法,这甚至可能吗?

所以这是我的示例:
带有文件 my_library.groovy 的“JenkinsLibrary”

def call(Map i_options)
{
// later I will parse the options to set the values, but currently the step before already crashes ...

    def axis_1_values = "axis_1_value_A"
// already tried the following alternatives ...
//    def axis_1_values = 'axis_1_value_A'
//    def axis_1_values = '''axis_1_value_A'''
//    def axis_1_values = ["axis_1_value_A", "axis_2_value_A"]
    pipeline
    {
        agent any
        stages { stage("stage A") { matrix { …
Run Code Online (Sandbox Code Playgroud)

jenkins jenkins-pipeline jenkins-declarative-pipeline

8
推荐指数
1
解决办法
3119
查看次数