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

Parameterized seed job is automatically triggered after change

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • job-dsl-plugin
    • None
    • Jenkins 1.580.2
      Job DSL 1.28

      We have setup the seed job to take parameters on build so that we are able to generate several job pipelines of the same type. (Background: we have a similar pipeline for all micro services and our seed job is able to spin up a pipeline for a new micro service in one step.)

      When changing the seed job's config and manually running a new build another build is automatically triggered on top with "Template has changed" given as build cause. This automatic build takes no manual user input and thus creates a new job setup with the default values provided for the parameters. This results in unwanted jobs on Jenkins.

      We have deselected "Ignore changes" as we do want a new run to update existing jobs, albeit only for the parametrized setup (and not for any other clones). It looks like setting "Ignore changes" to true does not trigger the issue, but this is not a viable solution in our case.

      Our current workaround is to detect those "ghost" builds with cause "Template has changed" via a quick shell step inside the seed job:

      set -e
      curl $BUILD_URL/api/json | grep -v "Template has changed"
      

      This will cause the automatic build to fail, while manually triggered builds pass. For us this is not viable solution in the long term.

      As far as we understand this is caused by https://github.com/jenkinsci/job-dsl-plugin/blob/master/job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/MonitorTemplateJobs.java#L83 although we do not understand what the intentions are.

      The job itself has no trigger configured under "Build Triggers" and as such we do not expect builds to be triggered automatically.

            daspilker Daniel Spilker
            cburgmer Christoph Burgmer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: