Open sodul opened 4 years ago
I am happy to accept pull request for this.
Bummer, we're also using folders, meaning I can't fetch the job status of the actual jobs inside the folder 😢
@BramDriesen try my workaround, it works well enough for us.
@sodul Yes, your workaround works fine :) but an native supported function would have been better ;)
I took a look at the code and it would take a bit of effort to add full support. Most importantly there are several design decisions that would need to be addressed:
Nevertheless nobody submitted pull request to add support for this. Why not?
I'm looking into it, but no promises. I have not worked with python 2 in several years so I'll have to get used to make things backward compatible if I do implement something.
Would you know the plans to deprecate 2.7 support so the codebase can be cleaned up?
@sodul maybe you can try https://api4jenkins.readthedocs.io/en/latest/user/example.html#folder
After submitting 2 PRs 3 weeks ago with no response I am switching to the python-jenkins library instead.
@sodul Care to send a link? 😄
@BramDriesen: https://pypi.org/project/python-jenkins/
ISSUE TYPE
Jenkinsapi 0.3.11
Jenkins 2.235.5
cloudbees-folder@6.9
SUMMARY
When creating a folder with
create_job()
it works fine, but then since this is not actually a job an exception is raised when jenkinsapi tries to get the job object back. It would need to be able to make the distinction between folders and jobs.Next issue is that to create a folder, or a job that is inside the folder the API url should be changed.
For example for job
foo/bar
the url that jenkinsapi tries to use ishttp://host/createItem?name=foo%2Fbar
but the url should behttp://host/job/foo/createItem?name=bar
. If the job isfoo/bar/baz
then the url would behttp://host/job/foo/job/bar/createItem?name=baz
.EXPECTED RESULTS
The folders and jobs in subfolders should be created without a glitch.
ACTUAL RESULTS
We get a
JenkinsAPIException: Operation failed.
error, and the job is not created.USEFUL INFORMATION
To reproduce install the Cloudbees Folder plugin: https://plugins.jenkins.io/cloudbees-folder/
Create folders and jobs under the folders.
This is a workaround to massage the baseurl: