简体   繁体   English

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

[英]Jenkins pipeline stage with variable in string parameter

I need to pass a variable into a string parameter from another job . 我需要将变量传递给另一个作业的字符串参数。 I have the parameterised string variable as entaClient . 我将参数化的字符串变量设置为entaClient See taskFilterName & tasksGroup 请参阅taskFilterNametasksGroup

How do I get this to work? 我该如何工作?

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)
                        ]
                    )
                }
            }
        }
    }

您可以使用字符串插值

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM