[英]Not getting parameter value while using Jenkins job trigger using URL
here I'm triggering my Jenkins job from URL with some parameters and trying to get that parameter values in my pipeline script 在这里,我使用一些参数从URL触发我的Jenkins作业,并尝试在我的管道脚本中获取该参数值
Here is the command with URL: 这是带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: 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 在这里,我能够触发我的Jenkins构建,但没有获得管道脚本中的值
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, 谢谢,
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 ) (与如何远程触发Jenkins构建并传递参数有些重复)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.