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

Java Pipeline job instances duplicated on each job modification

      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.

          [JENKINS-36612] Java Pipeline job instances duplicated on each job modification

          Emilio Escobar created issue -
          Emilio Escobar made changes -
          Description Original: 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

          {code:java}
          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)
                  }
              }
          }
          {code}

          - 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:

          {code:java}
          //...
          def pscript = """
          echo 'PIPELINE'
          input 'Pipeline has paused and needs your input before proceeding'
          node {
             echo 'inside the node'
          }
          echo 'BYE'
          echo 'one'
          """
          //...
          {code}

          - 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.

          New: 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

          {code:java}
          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)
                  }
              }
          }
          {code}

          - 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:

          {code:java}
          //...
          def pscript = """
          echo 'PIPELINE'
          input 'Pipeline has paused and needs your input before proceeding'
          node {
             echo 'inside the node'
          }
          echo 'BYE'
          echo 'one'
          """
          //...
          {code}

          - 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.

          Daniel Spilker made changes -
          Priority Original: Critical [ 2 ] New: Major [ 3 ]
          Daniel Spilker made changes -
          Component/s New: core [ 15593 ]
          Component/s New: workflow-plugin [ 18820 ]
          Assignee Original: Daniel Spilker [ daspilker ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 173333 ] New: JNJira + In-Review [ 185073 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-33971 [ JENKINS-33971 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Daniel Spilker made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: