-
Bug
-
Resolution: Unresolved
-
Major
-
None
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')
if j.has_job(template_job):
templ_job = j.get_job(template_job)
else:
print "Couldn't find template job " + template_job
sys.exit(1)
if not j.has_job(new_job):
if verbose:
print "Creating new job " + new_job
job = j.copy_job(template_job, new_job)
else:
job = j.get_job(new_job)
if verbose:
print "Modifying already existing job " + new_job
config = templ_job.get_config()
new_config = create_config(config, enable, **context)
job.update_config(new_config)
- is related to
-
JENKINS-20744 Don't hold off building until saved for jobs copied from CLI
-
- Resolved
-
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.