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

Pipeline SCM Step Plugin does not use the same git commit for the pipeline

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Critical Critical
    • pipeline
    • None

      I have a pipeline set where I want to test every commit. The pipeline basically builds some binaries and docker images and test them in some end to end test. While in reality I am doing stuff in parallel, the pipeline can be summarized in something like that:
      node {
      checkout scm
      // Build binary
      }

      node {
      checkout scm
      // Build docker
      ...
      }

      node {
      checkout scm
      // Run test
      ..
      }

      What I noticed is that, whenever a new commit is created on the git repo after my build started and before it finishes, it will be used whenever I do a new checkout scm in my pipeline.

      So basically what I expect is:
      1. Jenkins triggers a build for sha 1234
      2. Build binary at sha 1234
      3. Build docker at sha 1234
      4. Run test at sha 1234

      but what s happening is:
      1. Jenkins triggers a build for sha 1234
      2. Build binary at sha 1234
      3. Build docker at sha 1234 (1235 is pushed to the repo)
      4. Run test at sha 1235

      This is from my point of view a critical bug, because I cannot guarantee that my pipeline is using the same commit, which is a point of a pipeline.

      Here is beginning of the sample output: (first checkout from master)
      > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
      > git config remote.origin.url <url> # timeout=10
      Fetching upstream changes from <url>
      > git --version # timeout=10
      using .gitcredentials to set credentials
      > git config --local credential.username git # timeout=10
      > git config --local credential.helper store --file=/tmp/git1137924297392901966.credentials # timeout=10
      > git -c core.askpass=true fetch --tags --progress <url> +refs/heads/:refs/remotes/origin/
      > git config --local --remove-section credential # timeout=10
      > git rev-parse refs/remotes/origin/master^

      {commit} # timeout=10
      > git rev-parse refs/remotes/origin/origin/master^{commit}

      # timeout=10
      Checking out Revision 76a4e0619863feeeb0ece34abaf3ca39dda0207c (refs/remotes/origin/master)
      > git config core.sparsecheckout # timeout=10
      > git checkout -f 76a4e0619863feeeb0ece34abaf3ca39dda0207c
      > git rev-list 267cb5bb2783d0b60f5eff39e2f5a94d6a006c00 # timeout=10

      later in a different slave for the same build:
      Cloning the remote Git repository
      Cloning repository <url>
      > git init /home/jenkins/workspace/esp/esp-master # timeout=10
      Fetching upstream changes from <url>
      > git --version # timeout=10
      using .gitcredentials to set credentials
      > git config --local credential.username git # timeout=10
      > git config --local credential.helper store --file=/tmp/git9087494212953717077.credentials # timeout=10
      > git -c core.askpass=true fetch --tags --progress<url> +refs/heads/:refs/remotes/origin/
      > git config --local --remove-section credential # timeout=10
      > git config remote.origin.url <url> # timeout=10
      > git config --add remote.origin.fetch +refs/heads/:refs/remotes/origin/ # timeout=10
      > git config remote.origin.url <url> # timeout=10
      Fetching upstream changes from <url>
      using .gitcredentials to set credentials
      > git config --local credential.username git # timeout=10
      > git config --local credential.helper store --file=/tmp/git7997943737896634535.credentials # timeout=10
      > git -c core.askpass=true fetch --tags --progress <url> +refs/heads/:refs/remotes/origin/
      > git config --local --remove-section credential # timeout=10
      > git rev-parse refs/remotes/origin/master^

      {commit} # timeout=10
      > git rev-parse refs/remotes/origin/origin/master^{commit}

      # timeout=10
      Checking out Revision 3c96f4d9eaefb250bf08581462349373f1f60605 (refs/remotes/origin/master)
      > git config core.sparsecheckout # timeout=10
      > git checkout -f 3c96f4d9eaefb250bf08581462349373f1f60605

            rsandell rsandell
            netsabes Sebastien Vas
            Votes:
            3 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated:
              Resolved: