Status: Open (View Workflow)
Jenkins version 1.544.
I use the python jenkinsapi-0.2.16-py2.7 to copy a job and then get it's config, modify it and update it.
After that, the job is not buildable. If I disable it and reenable it again, it's buildable again.
I think this is a regression when
JENKINS-2494 was fixed. It worked well some Jenkins versions back. Se also JENKINS-20744 which deals with a similar problem for the CLI.
This is my python function that configures the job (XXX = censored info):
def create_job(template_job, new_job, enable=True, verbose=False, debug=False, **context):
Create a job from a template job.
j = jenkins.Jenkins('http://XXX', username='XXX', password='XXX')
templ_job = j.get_job(template_job)
print "Couldn't find template job " + template_job
if not j.has_job(new_job):
print "Creating new job " + new_job
job = j.copy_job(template_job, new_job)
job = j.get_job(new_job)
print "Modifying already existing job " + new_job
config = templ_job.get_config()
new_config = create_config(config, enable, **context)
- is related to
JENKINS-20744 Don't hold off building until saved for jobs copied from CLI
Any plans to fix this issue or a suggestion for a workaround that I can use from the REST API?
I use this feature to create a quite large number of jobs and it's not really feasible to disable/enable them manually and I can't restart Jenkins either since it's running jobs all the time.
Found a workaround myself. I use jenkinsapi job.disable() and job.enable().
Seems like huson.model.Job does clear the holdOffBuildUntilUserSave flag when calling save(), but not when calling updateByXml(…). This can probably solved by implementing updateByXml(…) in Job calling super's implementation and clearing the flag.