Zucoa
Zucoa

Reputation: 71

How to pass Value inserted in text box of Active choice reactive parameter to job

When I'm in "build with parameters" before starting job, I want to pass the value entered in a textbox to the Job. I´m using Active choice and Active choice reactive parameter like this:

Parameters

This is the groovy script which I then use to run job and show output. But I´m getting NULL on echo command.

node {       
    def commit = params.val

    stage ('Pulling code from Bitbucket') {

        git branch: 'master',
            credentialsId: '2bbc73c4-254e-45bd-85f4-6a169699310c',
            url: '[email protected]:repo/test.git'


        sh (""" echo ${commit}""")  
    }
}        

Which is the correct way to pass parameter into build ?

Upvotes: 0

Views: 2483

Answers (1)

MaratC
MaratC

Reputation: 6869

From your output, you have defined a parameter named ID1 that references some other parameter named OPTIONS. The correct way to reference these parameters is params.ID1 and params.OPTIONS. I can't see a parameter named val that can be addressed by params.val.

Upvotes: 0

Related Questions