ExportXMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Critical
    • None
    • Environment:

      Short summary

      Job DSL seed jobs are triggering continuous, unnecessary rescans of all Bitbucket multibranch jobs even when there are no DSL repository changes. Impact in our setup: seed runtime increases from seconds to 30+ minutes and the scan queue becomes severely congested.

      Crucial Context: While initially suspected to be a regression in the cloudbees-bitbucket-branch-source plugin (from 937.3.1 to 937.3.6), testing confirms the symptom is tied to a *Jenkins core version upgrade*.

      • *First Known Bad:* Jenkins 2.568.1
      • *Last Known Good:* Jenkins 2.555.2-lts-jdk21

      When running on Jenkins 2.568.1, the config.xml is rewritten (notably from XML 1.0 to XML 1.1) which seems to cause Job DSL to evaluate existing jobs as "changed" on every single run, triggering the infinite rescan loop.

      Environment

      • *Jenkins:* 2.568.1 (Failing) vs 2.555.2-lts (Working)
      • *Java:* JDK 21 (Docker image: jenkins/jenkins:2.555.2-lts-jdk21)
      • *Plugin:* cloudbees-bitbucket-branch-source 937.3.6

      Reproduction steps

      1. Run Jenkins 2.568.1 with cloudbees-bitbucket-branch-source 937.3.6.
      2. Create Bitbucket multibranch jobs using Job DSL.
      3. Run the seed job again without any repo or config changes.
      4. Observed: All multibranch jobs are rescanned on the 2nd run, 3rd run, etc. Every seed run triggers a full rescan => NOK.

      (Note: If jobs are created on plugin 937.3.1, everything is OK. Upgrading the plugin to 937.3.6 and running the seed job introduces the symptom. Applying a DSL config change to an existing job also introduces the symptom.)

      Expected result

      Seed job should report unchanged jobs as identical and should not trigger rescans when there are no relevant DSL changes.

      config.xml evolution (The likely culprit)

      Monitoring the config.xml reveals a structural rewrite on the newer Jenkins/plugin combo, which likely breaks Job DSL's diffing logic:

      Step 1 (created on 937.3.1, OK):

      <?xml version="1.0" encoding="UTF-8"?>
      <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
      ...
      <source plugin="cloudbees-bitbucket-branch-source@937.3.1" ...>
      

      Step 2 (after upgrade to 937.3.6 + seed run, NOK):

      <?xml version='1.1' encoding='UTF-8'?>
      <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject plugin="workflow-multibranch@...">
      ...
      <source ... plugin="cloudbees-bitbucket-branch-source@937.3.6">
      

      Step 3 (manual job delete + job recreate by DSL in 937.3.6, temporarily cured):

      <?xml version="1.0" encoding="UTF-8"?>
      <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject>
      ...
      <source plugin="cloudbees-bitbucket-branch-source@937.3.6" ...>
      

      Step 4 (apply DSL config change on recreated job, e.g., shallowClone(false) -> shallowClone(true), then seed run, NOK again):

      <?xml version='1.1' encoding='UTF-8'?>
      <org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject plugin="workflow-multibranch@...">
      ...
      <source ... plugin="cloudbees-bitbucket-branch-source@937.3.6">
      

      Result: Symptoms reappear and rescans are triggered on every subsequent seed run.

      Current Workarounds

      1. *Preferred:* Roll back Jenkins core image to jenkins/jenkins:2.555.2-lts-jdk21. Symptoms completely disappear.
      2. *Alternative:* Revert cloudbees-bitbucket-branch-source to 937.3.1, then delete and recreate the affected multibranch jobs via Job DSL.

      Request

      Please investigate the Job DSL / Bitbucket plugin compatibility with the serialization changes introduced in Jenkins 2.568.1.

            Assignee:
            Nikolas Falco
            Reporter:
            Nick
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: