1 year ago

#376203

test-img

abhi

conditionalize Parameter in Jenkins

we are trying to parameter below code If choice = dev and Method = post then show SITE_ID as an input else show SITE_ID,CUSTOMER_ID,REGION,PLATFORM_ACCOUNT_ID,PLATFORM_TYPE as an input

right now it is showing all columns SITE_ID,CUSTOMER_ID,REGION,PLATFORM_ACCOUNT_ID,PLATFORM_TYPE independent of choice selection

pipeline {

    parameters {
        choice(
                name: 'STAGE',
                choices: ['dev', 'stable', 'preprod'],
                description: 'The environment name (will not allow deploy on prod)'
        )
        choice(
                name: 'METHOD',
                choices: ['post', 'delete'],
                description: 'Method name'
        )
        string(
            name: 'SITE_ID', trim: true,
            description: 'Please provide SITE_ID'
        )
        string(
            name: 'CUSTOMER_ID', trim: true,
            description: 'Please provide CUSTOMER_ID'
        )
        string(
            name: 'REGION', trim: true,
            description: 'Please provide REGION'
        )
        string(
            name: 'PLATFORM_ACCOUNT_ID', trim: true,
            description: 'Please provide PLATFORM_ACCOUNT_ID'
        )
        string(
            name: 'PLATFORM_TYPE', trim: true,
            description: 'Please provide PLATFORM_TYPE'
        )
    }
}

jenkins

groovy

jenkins-plugins

0 Answers

Your Answer

Accepted video resources