Jenkins管道阶段与字符串参数中的变量

时间:2018-01-30 14:38:36

标签: linux jenkins-pipeline

我需要将变量传递给另一个作业的字符串参数。我将参数化字符串变量设为entaClient。见taskFilterName& tasksGroup

如何让它发挥作用?

stage('Restart the Enta API') {
    steps {
        script {
            if (params.hotReload.contains('Hot Reload')) {
                build(job: 'Hot Reload (utility)',
                    parameters: [
                        string(name: 'region', value: params.region),
                        string(name: 'cluster', value: params.cluster),
                        string(name: 'taskFilterName', value: enta-${entaClient}-dev-api-),
                        string(name: 'tasksGroup', value: enta-${entaClient}-dev-api-a,enta-${entaClient}-dev-api-b,
                        string(name: 'containerInstanceIdsToStartOn', value: params.containerInstanceIdsToStartOn)
                        ]
                    )
                }
            }
        }
    }

1 个答案:

答案 0 :(得分:2)

您可以使用string interpolation

string(name: 'taskFilterName', value: "enta-${entaClient}-dev-api-")