Ritesh Keloth
Ritesh Keloth

Reputation: 31

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

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

Upvotes: 3

Views: 2902

Answers (1)

Bruno P. Kinoshita
Bruno P. Kinoshita

Reputation: 373

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

Upvotes: 2

Related Questions