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

Revision checked out by "checkout scm" can change if new commits happen during build

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      If new commits go into a repo after a build has started we find later stages running against a different commit to the earlier stages.

      We've been using checkout scm + stash/unstash to work around this

      I've made a test repo to demonstrate the issue: https://github.com/leth/jenkins-pipeline-scm-test

        Attachments

          Activity

          Hide
          jglick Jesse Glick added a comment -

          Probably a variant of CpsScmFlowDefinition based on SCMSource could be constructed which would give the same guarantee as a multibranch project—basically it would act like a single branch project without a parent folder. Only certain SCMs would be compatible.

          Show
          jglick Jesse Glick added a comment - Probably a variant of CpsScmFlowDefinition based on SCMSource could be constructed which would give the same guarantee as a multibranch project—basically it would act like a single branch project without a parent folder. Only certain SCMs would be compatible.
          Hide
          mcobden Marcus Cobden added a comment -

          Oh! Sorry, that's easy to miss! Thanks for the clarification.

          Show
          mcobden Marcus Cobden added a comment - Oh! Sorry, that's easy to miss! Thanks for the clarification.
          Hide
          jglick Jesse Glick added a comment -

          just a normal project, not a multibranch project

          As the documentation for scm in Global Variables Reference notes, currently the idempotency guarantee is made only for multibranch projects. (Because the traditional Jenkins SCM API is too weak to do this.)

          Show
          jglick Jesse Glick added a comment - just a normal project, not a multibranch project As the documentation for scm in Global Variables Reference notes, currently the idempotency guarantee is made only for multibranch projects. (Because the traditional Jenkins SCM API is too weak to do this.)
          Hide
          mcobden Marcus Cobden added a comment -

          FWIW this is not a new regression, we noticed this ages ago, and have been using stash/unstash for ~6 months.
          I hadn't realised this wasn't intended behaviour.

          config.xml consoleText.txt

          Nothing complicated, just a normal project, not a multibranch project, see attached.

          Jenkins version 2.30, I updated all plugins yesterday, I can give you specific versions, but here are the pipeline ones:

          ```
          Pipeline: API - 2.6
          Pipeline: Basic Steps - 2.3
          Pipeline: Build Step - 2.3
          Pipeline: Declarative Agent API - 0.5
          Pipeline: Groovy - 2.22
          Pipeline: Input Step - 2.3
          Pipeline: Job - 2.8
          Pipeline: Milestone Step - 1.1
          Pipeline: Model API - 0.5
          Pipeline: Model Definition - 0.5
          Pipeline: Multibranch - 2.9
          Pipeline: REST API Plugin - 2.2
          Pipeline: SCM Step - 2.2
          Pipeline: Shared Groovy Libraries - 2.4
          Pipeline: Stage Step - 2.2
          Pipeline: Stage View Plugin - 2.2
          Pipeline: Step API - 2.5
          Pipeline: Supporting APIs - 2.10
          ```

          Show
          mcobden Marcus Cobden added a comment - FWIW this is not a new regression, we noticed this ages ago, and have been using stash/unstash for ~6 months. I hadn't realised this wasn't intended behaviour. config.xml consoleText.txt Nothing complicated, just a normal project, not a multibranch project, see attached. Jenkins version 2.30, I updated all plugins yesterday, I can give you specific versions, but here are the pipeline ones: ``` Pipeline: API - 2.6 Pipeline: Basic Steps - 2.3 Pipeline: Build Step - 2.3 Pipeline: Declarative Agent API - 0.5 Pipeline: Groovy - 2.22 Pipeline: Input Step - 2.3 Pipeline: Job - 2.8 Pipeline: Milestone Step - 1.1 Pipeline: Model API - 0.5 Pipeline: Model Definition - 0.5 Pipeline: Multibranch - 2.9 Pipeline: REST API Plugin - 2.2 Pipeline: SCM Step - 2.2 Pipeline: Shared Groovy Libraries - 2.4 Pipeline: Stage Step - 2.2 Pipeline: Stage View Plugin - 2.2 Pipeline: Step API - 2.5 Pipeline: Supporting APIs - 2.10 ```
          Hide
          jglick Jesse Glick added a comment -

          What branch source are you using in this example? (E.g., config.xml of multibranch project.) And what software versions? I would need to be able to reproduce from scratch, since there has long been automated test coverage demonstrating that the same revision is checked out each time. Also please attach the build log.

          Show
          jglick Jesse Glick added a comment - What branch source are you using in this example? (E.g., config.xml of multibranch project.) And what software versions? I would need to be able to reproduce from scratch , since there has long been automated test coverage demonstrating that the same revision is checked out each time. Also please attach the build log.

            People

            • Assignee:
              Unassigned
              Reporter:
              mcobden Marcus Cobden
            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: