You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jenkins api follows the pattern {baseUrl}/job/{JOB_NAME}. However, if we have jobs nested in folders the job the pattern is {baseUrl}/job/{path}/job/{to}/job/{folder}job/{finalName}. In the UI, Jenkins shows this job name as path/to/folder/finalName.
On my first attempt at consuming the library I passed in the job name as shown in the UI. Perhaps you can consider expanding it so that either works or make it clearer which format is expected.
@pjmagee I had to look at this twice to see what you were actually doing, I didn't catch the inner job lookup on first pass. The first portion of what your doing already exists in the Jenkins class under the Jobs property. You can use this to retrieve all Job urls as you are above.
var client = new JenkinsClient(...);
return client.Get().Jobs.Select(x => x.Url);
Unfortunately there is currently no way to lookup the details for that job, since the JobGetCommand relies on the flat url structure.
@petelopez Sorry, to be honest I don't even use Jenkins anymore so this project has become secondary. With the growing number of user for this library though, I'm trying to come back and maintain requests. I think this is a good request and should be implemented, but it may take me a bit of time to setup Jenkins again and create a nested job layout for testing.
Based on your example though, it looks like a user should be able to pass "path/to/folder/finalName" as the jobName argument, and the library can just split on / and prefix every segment with job/.
Activity
pjmagee commentedon Mar 27, 2019
I can't seem to get child jobs from Jobs, so this library doesn't really work for me. Or is there something i misunderstand?
petelopez commentedon Mar 28, 2019
The Jenkins REST API does return the child jobs. If this library isn't exposing that we should be able to modify it simply enough.
pjmagee commentedon Mar 28, 2019
I ended up doing my own custom API manipulation for my own needs and got ALL jobs like this.
null511 commentedon May 28, 2019
@pjmagee I had to look at this twice to see what you were actually doing, I didn't catch the inner job lookup on first pass. The first portion of what your doing already exists in the
Jenkinsclass under theJobsproperty. You can use this to retrieve all Job urls as you are above.Unfortunately there is currently no way to lookup the details for that job, since the
JobGetCommandrelies on the flat url structure.@petelopez Sorry, to be honest I don't even use Jenkins anymore so this project has become secondary. With the growing number of user for this library though, I'm trying to come back and maintain requests. I think this is a good request and should be implemented, but it may take me a bit of time to setup Jenkins again and create a nested job layout for testing.
Based on your example though, it looks like a user should be able to pass "path/to/folder/finalName" as the jobName argument, and the library can just split on
/and prefix every segment withjob/.christoffersch commentedon Mar 22, 2023
So... what do I pass in as the "job name" when I have a child job? Passing in the URL doesn't work
Edit: nevermind, figured it out: the syntax is SomeJob/job/SomeChildJob