Open sschwarzer opened 10 years ago
By the way, adding support for folders (to create the folders for the jobs to begin with) seems to be trivial. If you create a "job", but use the config.xml
of an existing folder, the REST API creates a new folder. I assume you'll need the folders plugin (see above) to be installed.
Hello, and sorry for the late reply.
The Folder plugin actually breaks a lot of things. For example:
>>> j.jobs
[Job('RealJob'), Job('FolderName')]
>>> j.jobs[0].buildnumbers
[1, 2, 3]
>>> j.jobs[1].buildnumbers
KeyError: 'builds' # because it's not really a Job
I'm not too sure about adding special handling for plugins to jenkins-webapi - I'll give it some more though. Please consider the following workaround in the meantime:
>>> j = Jenkins('http://jenkins.sschwarzer.com/FolderName')
>>> j.jobs # all jobs in this folder
>>> j.create_job('new') # creates a job in the folder
Well I'm a bit late to the party, but I want to note that the suggested workaround does not work for Jenkins instances that are configured with CSRF protection enabled, because unfortunately it is not possible to request the crumb on the folder level.
Hello, thanks for your library. :-)
This issue is for jenkins-webapi version 0.3.0.
When I tried to create a new job inside a folder (created with the Cloudbees Folder Plugin, https://wiki.jenkins-ci.org/display/JENKINS/CloudBees+Folders+Plugin ) with
job2 = server.job_create("TestFolder/TestJob2", job_config)
(where
server
is aJenkins
instance andjob.config
is the XML configuration of an already existing job) I got the following traceback:It seems that the library tries to use
/createItem?name=TestFolder/TestJob2
as the URL path instead of/job/TestFolder?createItem?name=TestJob2
.Stefan