Does 'scm checkout' always give the same result with parallel builds in JenkinsFiles ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Does 'scm checkout' always give the same result with parallel builds in JenkinsFiles ?

sleipnir
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does 'scm checkout' always give the same result with parallel builds in JenkinsFiles ?

Mark Waite-2
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.



Those fixes have not yet been included in a plugin release.

Mark Waite

On Wed, Sep 21, 2016 at 9:38 PM sleipnir <[hidden email]> 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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com.
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Does 'scm checkout' always give the same result with parallel builds in JenkinsFiles ?

sleipnir

Thanks for the quick reply.
Any info about the recommended way to get the sha that was actually used ?

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/23b09958-5f34-46ac-b0f8-715be4fd5f06%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does 'scm checkout' always give the same result with parallel builds in JenkinsFiles ?

guy.israeli
In reply to this post by Mark Waite-2
Was this merged already?
Is it safe to use checkout scm within for parallel jobs?

On Thursday, September 22, 2016 at 6:53:06 AM UTC+3, Mark Waite wrote:
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 <a href="https://github.com/jenkinsci/git-plugin/commit/cd6c7cdcba29f5c3615ad35d690678ebd5694348" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgit-plugin%2Fcommit%2Fcd6c7cdcba29f5c3615ad35d690678ebd5694348\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEQNtNg5VNyo6gs8rtOPuVv2L3iKA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgit-plugin%2Fcommit%2Fcd6c7cdcba29f5c3615ad35d690678ebd5694348\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEQNtNg5VNyo6gs8rtOPuVv2L3iKA&#39;;return true;">https://github.com/jenkinsci/git-plugin/commit/cd6c7cdcba29f5c3615ad35d690678ebd5694348 .

Tests which confirm the fix has the desired behavior are in <a href="https://github.com/jenkinsci/git-plugin/commit/e15a431a62781c6081c57354a33a7e148a4452a1" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgit-plugin%2Fcommit%2Fe15a431a62781c6081c57354a33a7e148a4452a1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFB4aXu9k1wvVBN5gaFBH8SDJx5iA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgit-plugin%2Fcommit%2Fe15a431a62781c6081c57354a33a7e148a4452a1\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFB4aXu9k1wvVBN5gaFBH8SDJx5iA&#39;;return true;">https://github.com/jenkinsci/git-plugin/commit/e15a431a62781c6081c57354a33a7e148a4452a1 and <a href="https://github.com/jenkinsci/git-plugin/commit/fcbdc768536c2c5286680734bbedc64fec0103c2" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgit-plugin%2Fcommit%2Ffcbdc768536c2c5286680734bbedc64fec0103c2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHptXYP1mNaHdlqjl4D6ROszbFFqw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fgit-plugin%2Fcommit%2Ffcbdc768536c2c5286680734bbedc64fec0103c2\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHptXYP1mNaHdlqjl4D6ROszbFFqw&#39;;return true;">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 <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="9881dTO9BQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ke...@...> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="9881dTO9BQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/4fb3bb94-a954-4e2e-aecf-5786432aa08b%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e5220124-473a-4552-bbf4-38a7f73a4220%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Does 'scm checkout' always give the same result with parallel builds in JenkinsFiles ?

Mark Waite-2
It was released as part of git plugin versions git-3.1.0,  git-3.0.5, git-3.0.4, git-3.0.3, git-3.0.2, git-3.0.1, git-2.6.5, git-2.6.4, git-2.6.2, and  git-2.6.1.

Mark Waite

On Sun, Mar 19, 2017 at 2:07 AM <[hidden email]> wrote:
Was this merged already?
Is it safe to use checkout scm within for parallel jobs?


On Thursday, September 22, 2016 at 6:53:06 AM UTC+3, Mark Waite wrote:
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.



Those fixes have not yet been included in a plugin release.

Mark Waite

On Wed, Sep 21, 2016 at 9:38 PM sleipnir <[hidden email]> 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 [hidden email].

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e5220124-473a-4552-bbf4-38a7f73a4220%40googlegroups.com.
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtG_LpaihuAHJN%3D-Nxpq2jOtMr%3D64QgC9B3oejw1c%3DekEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.