Issue
is there a way to using groovy get description of other jenkins job than "currentBuild" ?
I was trying jenkins.model.Jenkins.instance.getItem(<job_name>).lastBuild.getBuildVariables().get("Description");
but it doesn't work. It always returns that jenkins.model.Jenkins.instance.getItem(<job_name>)
is a null object.
What makes it harder is that job is in project (folder)
https://jenkins.xxx/job/FOLDERJOBS/job/JOB_TO_BE_EXTRACTED
Thanks
Solution
Just use jenkins.model.Jenkins.instance.getItemByFullName()
instead of getItem()
.
That method works with full job names (including folders), like FOLDERJOBS/JOB_TO_BE_EXTRACTED
.
Answered By - Alex O