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

Java Pipeline job instances duplicated on each job modification

    Details

    • Similar Issues:

      Description

      The pipeline job java instances are duplicated in memory on each job-dsl execution (affecting to pipeline items modification).

      The steps to reproduce the issue are:

      • Create a freestyle job with this Process Job DSLs build step script
      freeStyleJob('dsl-free-upstream') {
          description 'FREESTYLE'
          quietPeriod(0)
          concurrentBuild(true)
          steps {
              shell 'sleep 2'
              shell 'echo "UPSTREAM"'
            shell 'echo "BYE"'
          }
      }
      
      def pscript = """
      echo 'PIPELINE'
      input 'Pipeline has paused and needs your input before proceeding'
      node {
         echo 'inside the node'
      }
      echo 'BYE'
      """
      
      workflowJob('dsl-pipeline') {
        description 'PIPELINE'
        quietPeriod(0)
        triggers {
           upstream('dsl-free-upstream', 'SUCCESS')
        }
        definition {
              cps {
                  script(pscript)
              }
          }
      }
      
      • Build the dsl job.
      • Build the dsl-free-upstream job
      • Look for that in the console output

      {{BYE
      Triggering a new build of dsl-pipeline #1
      Finished: SUCCESS}}

      • Modified the dsl job script pscript, for example:
      //...
      def pscript = """
      echo 'PIPELINE'
      input 'Pipeline has paused and needs your input before proceeding'
      node {
         echo 'inside the node'
      }
      echo 'BYE'
      echo 'one'
      """
      //...
      
      • Build the dsl job.
      • Build the dsl-free-upstream job
      • Look for that in the console output

      {{BYE
      Triggering a new build of dsl-pipeline #2
      Triggering a new build of dsl-pipeline #2
      Finished: SUCCESS}}

      If you add more modifications in the pipeline definition, more instances will appears.

        Attachments

          Issue Links

            Activity

            Hide
            daspilker Daniel Spilker added a comment -

            This is not a Job DSL problem, Job DSL just updates the job's configuration through AbstractItem#updateByXml. I think the problem is related to ReverseBuildTrigger and how it keeps track of the build dependency graph.

            As a workaround you can use the downstream publisher:

            freeStyleJob('dsl-free-upstream') {
              // ...
              publishers {
                downstream('dsl-pipeline')
              }
            }
            
            Show
            daspilker Daniel Spilker added a comment - This is not a Job DSL problem, Job DSL just updates the job's configuration through AbstractItem#updateByXml . I think the problem is related to ReverseBuildTrigger and how it keeps track of the build dependency graph. As a workaround you can use the downstream publisher: freeStyleJob( 'dsl-free-upstream' ) { // ... publishers { downstream( 'dsl-pipeline' ) } }
            Hide
            jglick Jesse Glick added a comment -

            Possibly you were seeing JENKINS-33971.

            Show
            jglick Jesse Glick added a comment - Possibly you were seeing JENKINS-33971 .

              People

              • Assignee:
                Unassigned
                Reporter:
                escoem Emilio Escobar
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: