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

multibranchPipelineJob overrides old branch indexing sources

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: job-dsl-plugin
    • Labels:
      None
    • Environment:
      Debian 8
      Jenkins 2.46.1 (as service)

      Plugins (all newest stable):
      Job DSL 1.61
      Pipeline: Multibranch 2.14
    • Similar Issues:

      Description

      When running the multibranchPipelineJob step it seems like it overrides the sources of a Multibranch Pipeline Job instead of just updating it. After running the step, even though nothing has changed the output of the branch indexing will become:

      Checking branch master
            ‘Jenkinsfile’ found
      Met criteria
      Takeover for job-dsl-plugin_multibranch » master by source #1 from source that no longer exists
      Branch reopened: master (b409f3996299dd12244d6cf7f8b6d8df3aa674ca)
      Scheduled build for branch: master
      

       

      To test this, I have installed a brand new Jenkins with the Pipeline plugins and Job DSL plugin (all as the stable version) and made a freestyle job, with a Job DSL step that has the following script:

      multibranchPipelineJob('job-dsl-plugin_multibranch') {
        branchSources {
          git { 
            remote('https://github.com/jenkinsci/job-dsl-plugin.git')
          }
        }
      }
      

       

      After running the Job DSL step and afterwards running branch indexing a "master" job is created with the following log message from branch indexing:

      Checking branch master
            ‘Jenkinsfile’ found
      Met criteria
      Scheduled build for branch: master
      

       

      When running branch indexing again, following log message are shown as expected:

      Checking branch master
            ‘Jenkinsfile’ found
      Met criteria
      No changes detected: master (still at b409f3996299dd12244d6cf7f8b6d8df3aa674ca)
      

       

      However, if I run the Job DSL again and run branch indexing, the first log message (with takeover and so on) are shown. This is not what I would have expected, I would have expected something like a "no changes detected" message.

       

        Attachments

          Activity

          anigif Anders Kielsholm created issue -
          anigif Anders Kielsholm made changes -
          Field Original Value New Value
          Description When running the multibranchPipelineJob step it seems like it overrides the sources of a Multibranch Pipeline Job instead of just updating it. After running the step, even though nothing has changed the output of the branch indexing will become:

           
          {code:java}
          Checking branch master
                ‘Jenkinsfile’ found
          Met criteria
          Takeover for job-dsl-plugin_multibranch » master by source #1 from source that no longer exists
          Branch reopened: master (b409f3996299dd12244d6cf7f8b6d8df3aa674ca)
          Scheduled build for branch: master
          {code}
           

           

          To test this, I have installed a brand new Jenkins with the Pipeline plugins and Job DSL plugin (all as the stable version) and made a freestyle job, with a Job DSL step that has the following script:

           
          {code:java}
          multibranchPipelineJob('job-dsl-plugin_multibranch') {
            branchSources {
              git {
                remote('https://github.com/jenkinsci/job-dsl-plugin.git')
              }
            }
          }
          {code}
           

           

          After running the Job DSL step and afterwards running branch indexing a "master" job is created with the following log message from branch indexing:
          {code:java}
          Checking branch master
                ‘Jenkinsfile’ found
          Met criteria
          Scheduled build for branch: master
          {code}
          When running branch indexing again, following log message are shown as expected:

           

           
          {code:java}
          Checking branch master
                ‘Jenkinsfile’ found
          Met criteria
          No changes detected: master (still at b409f3996299dd12244d6cf7f8b6d8df3aa674ca)
          {code}
          However, if I run the Job DSL again and run branch indexing, the first log message (with takeover and so on) are shown. This is not what I would have expected, I would have expected something like a "no changes detected" message.

           
          When running the multibranchPipelineJob step it seems like it overrides the sources of a Multibranch Pipeline Job instead of just updating it. After running the step, even though nothing has changed the output of the branch indexing will become:
          {code:java}
          Checking branch master
                ‘Jenkinsfile’ found
          Met criteria
          Takeover for job-dsl-plugin_multibranch » master by source #1 from source that no longer exists
          Branch reopened: master (b409f3996299dd12244d6cf7f8b6d8df3aa674ca)
          Scheduled build for branch: master
          {code}
           

          To test this, I have installed a brand new Jenkins with the Pipeline plugins and Job DSL plugin (all as the stable version) and made a freestyle job, with a Job DSL step that has the following script:
          {code:java}
          multibranchPipelineJob('job-dsl-plugin_multibranch') {
            branchSources {
              git {
                remote('https://github.com/jenkinsci/job-dsl-plugin.git')
              }
            }
          }
          {code}
           

          After running the Job DSL step and afterwards running branch indexing a "master" job is created with the following log message from branch indexing:
          {code:java}
          Checking branch master
                ‘Jenkinsfile’ found
          Met criteria
          Scheduled build for branch: master
          {code}
           

          When running branch indexing again, following log message are shown as expected:
          {code:java}
          Checking branch master
                ‘Jenkinsfile’ found
          Met criteria
          No changes detected: master (still at b409f3996299dd12244d6cf7f8b6d8df3aa674ca)
          {code}
           

          However, if I run the Job DSL again and run branch indexing, the first log message (with takeover and so on) are shown. This is not what I would have expected, I would have expected something like a "no changes detected" message.

           
          scm_issue_link SCM/JIRA link daemon made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          daspilker Daniel Spilker made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          duemir Denys Digtiar made changes -
          Resolution Fixed [ 1 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          duemir Denys Digtiar made changes -
          Status Reopened [ 4 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]

            People

            • Assignee:
              daspilker Daniel Spilker
              Reporter:
              anigif Anders Kielsholm
            • Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: