Hi,
I am using a groovy script to walk through all jobs, and find the
multibranch jobs in a github project. I want to get the full path name to
the job, and I'm having problems figuring out what property to pull, even
though I can see that the object knows its full path.
Here's what I mean -- Here's a sample of the code:
for (item in Jenkins.instance.items) {
println("Item " + item)
if(item.hasProperty("items")) {
for(item1 in item.items) {
println("Item " + item1)
if(item1.hasProperty("items")) {
for(item2 in item1.items) {
println("Item " + item2)
}
}
}
}
}
If I run this, I can see that the jobs found known their full path. This
outputs this:
Item jenkins.branch.OrganizationFolder@41f1ea07[MyOrg]
Item
org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject@6d24ed54[MyOrg/MyProject]
Item
org.jenkinsci.plugins.workflow.job.WorkflowJob@5e6f7f42[MyOrg/MyProject/master]
I want to get "MyOrg/MyProject/master" -- obviously the WorkflowJob knows
that's what it is.
But if I just look at item2.name, its just "master". No property value seems
to be the full path, which is what I need. I can calculate it pretty easy with
getParent() calls, but it just feels like its already there, and I'm just not
pulling the correct value...
Thanks for the help,
Greg
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/60b312db-4065-44a3-9508-7684af45a0dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.