简体   繁体   中英

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 . See taskFilterName & tasksGroup

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-")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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