Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21087

Don't hold off building until saved for jobs copied and updated from REST API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • core
    • 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)

            Unassigned Unassigned
            magjac Magnus Jacobsson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: