Retrieving Jenkins job name using groovy script in Active Choice Reactive Parameter

依然范特西╮ 提交于 2020-01-15 08:25:31

问题


I am unable to retrieve the Job name using groovy script below. Even when I run this script in the Execute System Groovy Build Step, it gives me the error as. Error:

groovy.lang.MissingPropertyException: No such property: jenkinsProject for class: groovy.lang.Binding

----
def jobName = this.binding.jenkinsProject.name
----

I found in the below link that it has worked for someone, but somehow not working for me. Can anyone help please?

How to get the job name on a groovy dynamic parameter in Jenkins


回答1:


The v1.3 and v1.4 (released in a couple of days once manual testing is done) both should support this feature. Just use jenkinsProject in you code and that should work fine. Other wise just let us know via issues.jenkins-ci.org, component=active-choices-plugin.

The v1.4 has a bug fix that allows you to use this variable with Matrix projects as well.

Hope that helps, Bruno



来源:https://stackoverflow.com/questions/33107687/retrieving-jenkins-job-name-using-groovy-script-in-active-choice-reactive-parame

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!