The intent of the checkout scm step is that it takes a single revision, and uses that revision for the duration of the job.
Unfortunately, a bug was found during discussions after Jenkins World which seem to indicate that there area cases where git plugin 2.5.3 and beyond risks not checking out the same revision for every use of "checkout scm" within a single job. The fix is in https://github.com/jenkinsci/git-plugin/commit/cd6c7cdcba29f5c3615ad35d690678ebd5694348 . Tests which confirm the fix has the desired behavior are in https://github.com/jenkinsci/git-plugin/commit/e15a431a62781c6081c57354a33a7e148a4452a1 and https://github.com/jenkinsci/git-plugin/commit/fcbdc768536c2c5286680734bbedc64fec0103c2 . Those fixes have not yet been included in a plugin release. Mark Waite On Wed, Sep 21, 2016 at 9:38 PM sleipnir <ke...@ityrant.net> wrote: > Hi > > I was playing with JenkinsFiles and Organization folders (multi-branch > pipeline) and I was wondering: > Is there is any guarantee the 'checkout scm' command would checkout the > exact same revision on all node, even if new commits are pushed before the > build is finished ? > Also, I saw an environment variable that gives the branch name > (BRANCH_NAME) but nothing for the revision. > Do I have to call a git command after the 'checkout scm' command to > extract the sha1 so I can stamp the build output properly ? (something like > 'git rev-parse HEAD') > > Here's a test jenkinsfile I'm using: > > stage 'build' > > parallel ( > BuildDebug: { node { > checkout scm > > > }}, > BuildRelease: { node { > checkout scm > > }} > ) > > Thanks > > -- > You received this message because you are subscribed to the Google Groups > "Jenkins Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to jenkinsci-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com > <https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFOnhAy_1Xs%2BWA%3DbzGw4X6t6EeAs9i9g3y0%3DRyJtiCX4w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.