Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jenkinsfile parameter properties not configured in jenkins server at initial branch creation

I have configured jenkinsfile with below properties, but it doesn't apply on jenkins server when creating a new branch from master branch.

#!groovy

properties([[$class: 'ParametersDefinitionProperty',
    parameterDefinitions: [
        [$class: 'StringParameterDefinition', name: 'isValid', defaultValue: 'false']
    ]
]])

node {
    stage 'Checkout'        
        checkout scm
    .....
    .....
}

After branch created in git, the branch is visible in the jenkins server with Build Now option.

Once I run the branch first time from the jenkins server, it is changed into Build with Parameters option.

Is there anything I missed to configure in jenkinsfile? Why the parameters not configured in the jenkins server at branch creation?

like image 760
Yahwe Raj Avatar asked Nov 24 '16 09:11

Yahwe Raj


1 Answers

You can get around this by using params.isValid instead of env.isValid.

like image 157
paul.letang Avatar answered Sep 22 '22 12:09

paul.letang