0

here I'm triggering my Jenkins job from URL with some parameters and trying to get that parameter values in my pipeline script

Here is the command with URL:

curl -k -v -u user:secrate http://IP:PORT/jenkins/job/GROUP-GROUP/view/Deploy-Jobs/job/Automate-deployment-JOB/buildWithParameters?token=MY-TOCKEN&MY-PARAMETOR=some_value

Pipeline script of jenkins JOB:

pipeline {
    agent none
    stages{
        stage ('test') {
            agent { label 'My-Slave' }
            steps {
                println "$MY-PARAMETOR"
            }
        }
    }
}

Here I'm able to trigger my Jenkins build but not getting the value in pipeline script

Getting the following error:

groovy.lang.MissingPropertyException: No such property: MY-PARAMETOR for class: groovy.lang.Binding

Can any one please help me on this?

Thanks,

Ashwani
  • 485
  • 2
  • 9
  • 23

1 Answers1

0

You need to make sure the parameter is defined in the pipeline first. See:

(Somewhat duplicate to How to trigger Jenkins builds remotely and to pass parameters)

nogenius
  • 574
  • 1
  • 6
  • 18