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

SCM steps should return revision state

    Details

    • Similar Issues:

      Description

      The return value of the git step should be the commit hash, etc., and there should be a way to pass that back in to a subsequent git step in case you want to check out the same revision in another workspace (without copying files).

      The workaround is to archive and then unarchive sources.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Requires some kind of enhanced API from SCM.

            Show
            jglick Jesse Glick added a comment - Requires some kind of enhanced API from SCM .
            Hide
            tg9541 Thomas Goeppel added a comment -

            Not just for GIT, please. We have a similar use case for other SCMs, too.

            Show
            tg9541 Thomas Goeppel added a comment - Not just for GIT, please. We have a similar use case for other SCMs, too.
            Hide
            jglick Jesse Glick added a comment -

            Sure, I was just using Git as an example.

            Show
            jglick Jesse Glick added a comment - Sure, I was just using Git as an example.
            Hide
            jglick Jesse Glick added a comment -

            Features in scm-api (as in JENKINS-26129) might be enough to both determine the current tip, and preconfigure an SCM to check that out.

            Show
            jglick Jesse Glick added a comment - Features in scm-api (as in JENKINS-26129 ) might be enough to both determine the current tip, and preconfigure an SCM to check that out.
            Hide
            danielbeck Daniel Beck added a comment -

            Related: Subversion Plugin has RevisionParameterAction to build a predetermined revision.

            Show
            danielbeck Daniel Beck added a comment - Related: Subversion Plugin has RevisionParameterAction to build a predetermined revision.
            Hide
            jglick Jesse Glick added a comment -

            Good to know, though the more generic approach would be to take advantage of the logic in SubversionSCMSource.build.

            Show
            jglick Jesse Glick added a comment - Good to know, though the more generic approach would be to take advantage of the logic in SubversionSCMSource.build .
            Hide
            nexus49 Bastian Echterhoelter added a comment -

            Just to mention another workaround on this topic.

            You can also pipe the current revision into a file and archive that file to be reused later on in the workflow instead of the complete source code.

            Show
            nexus49 Bastian Echterhoelter added a comment - Just to mention another workaround on this topic. You can also pipe the current revision into a file and archive that file to be reused later on in the workflow instead of the complete source code.
            Hide
            jglick Jesse Glick added a comment -

            Or just pipe into a file and readFile it as a string.

            Show
            jglick Jesse Glick added a comment - Or just pipe into a file and readFile it as a string.
            Hide
            robjailall Robert Jay added a comment -

            Also interested in this. We use something like this for integrations, where if someone commits a change to a shared library, we want to use that version of the shared library in integration tests with downstream projects that use the library.

            Show
            robjailall Robert Jay added a comment - Also interested in this. We use something like this for integrations, where if someone commits a change to a shared library, we want to use that version of the shared library in integration tests with downstream projects that use the library.
            Hide
            jglick Jesse Glick added a comment -

            Robert Jay if you use a multibranch flow (JENKINS-26129) you get this out of the box, assuming the logic is all in one job.

            Show
            jglick Jesse Glick added a comment - Robert Jay if you use a multibranch flow ( JENKINS-26129 ) you get this out of the box, assuming the logic is all in one job.
            Hide
            jglick Jesse Glick added a comment -

            JENKINS-31386 would also help for the common case of checking out the script from the same repository.

            Show
            jglick Jesse Glick added a comment - JENKINS-31386 would also help for the common case of checking out the script from the same repository.
            Hide
            as_kumlali Ali Sadik Kumlali added a comment -

            I tried Pipeline and Multibranch Pipeline options with Jenkins 2.0 alpha-3, but env.SVN_REVISION was null:

            • New Item -> Pipeline -> Pipeline Script:
              node {
                 checkout scm: [$class: 'SubversionSCM', locations: [[ remote:'https://svn.mycompany.com/repos/mw/maventest/trunk', credentialsId: '...', local: '.']]]
                 println 'env.SVN_REVISION: ' + env.SVN_REVISION
              }
              
            • New Item -> Pipeline -> Pipeline from SCM -> SCM: Subversion -> Repository URL: https://svn.mycompany.com/repos/mw/maventest/trunk, Credentials: ..., Script Path: Jenkinsfile
              Jenkinsfile
              node {
                 println 'env.SVN_REVISION: ' + env.SVN_REVISION
              }
              
            • New Item -> Multibranch Pipeline -> Branch Sources: Subversion -> Project Repository Base: https://svn.mycompany.com/repos/mw/maventest, Credentials: ..., Include branches: trunk
              Jenkinsfile
              node {
                 println 'env.SVN_REVISION: ' + env.SVN_REVISION
              }
              
            Show
            as_kumlali Ali Sadik Kumlali added a comment - I tried Pipeline and Multibranch Pipeline options with Jenkins 2.0 alpha-3, but env.SVN_REVISION was null: New Item -> Pipeline -> Pipeline Script: node { checkout scm: [$class: 'SubversionSCM' , locations: [[ remote: 'https: //svn.mycompany.com/repos/mw/maventest/trunk' , credentialsId: '...' , local: '.' ]]] println 'env.SVN_REVISION: ' + env.SVN_REVISION } New Item -> Pipeline -> Pipeline from SCM -> SCM: Subversion -> Repository URL: https://svn.mycompany.com/repos/mw/maventest/trunk , Credentials: ..., Script Path: Jenkinsfile Jenkinsfile node { println 'env.SVN_REVISION: ' + env.SVN_REVISION } New Item -> Multibranch Pipeline -> Branch Sources: Subversion -> Project Repository Base: https://svn.mycompany.com/repos/mw/maventest , Credentials: ..., Include branches: trunk Jenkinsfile node { println 'env.SVN_REVISION: ' + env.SVN_REVISION }
            Hide
            jglick Jesse Glick added a comment -

            Yes, as documented under env in Pipeline Syntax » Global Variables this is not yet supported. You need to git rev-parse HEAD etc.

            Show
            jglick Jesse Glick added a comment - Yes, as documented under env in Pipeline Syntax » Global Variables this is not yet supported. You need to git rev-parse HEAD etc.
            Hide
            jglick Jesse Glick added a comment -

            For a multibranch Pipeline job (Jenkinsfile), it would be straightforward to expose the SCMRevision as a special Groovy variable, as it is Serializable. Depending on the SCM source, you will get various available properties, such as hash in the case of Git branches (JENKINS-33161 would offer pullHash for pull request builds), though these would need to be marked @Whitelisted too.

            For general use including non-multibranch builds it would be desirable to get variables generically from the checkout step though this would require a core API change (JENKINS-24141). For the case of the git and svn convenience steps these could directly return the revision.

            Show
            jglick Jesse Glick added a comment - For a multibranch Pipeline job ( Jenkinsfile ), it would be straightforward to expose the SCMRevision as a special Groovy variable, as it is Serializable . Depending on the SCM source, you will get various available properties, such as hash in the case of Git branches ( JENKINS-33161 would offer pullHash for pull request builds), though these would need to be marked @Whitelisted too. For general use including non-multibranch builds it would be desirable to get variables generically from the checkout step though this would require a core API change ( JENKINS-24141 ). For the case of the git and svn convenience steps these could directly return the revision.
            Hide
            zaytsev_work Yury Zaytsev added a comment -

            I understand that this is still not implemented, therefore one needs to go the rev-parse way, but is there a possibility to modify scm object to use the correct revision, instead of making a brand new one, like

            checkout([$class: 'GitSCM', branches: [[name: 'XXX']], extensions: [[$class: 'SubmoduleOption', parentCredentials: true], [$class: 'CleanCheckout']], userRemoteConfigs: [[credentialsId: 'YYY', url: 'ZZZ']]])
            

            and basically have to duplicate all the SCM settings? Sorry for a newb Groovy question, if this is trivial.

            Show
            zaytsev_work Yury Zaytsev added a comment - I understand that this is still not implemented, therefore one needs to go the rev-parse way, but is there a possibility to modify scm object to use the correct revision, instead of making a brand new one, like checkout([$class: 'GitSCM' , branches: [[name: 'XXX' ]], extensions: [[$class: 'SubmoduleOption' , parentCredentials: true ], [$class: 'CleanCheckout' ]], userRemoteConfigs: [[credentialsId: 'YYY' , url: 'ZZZ' ]]]) and basically have to duplicate all the SCM settings? Sorry for a newb Groovy question, if this is trivial.
            Hide
            jglick Jesse Glick added a comment -

            modify scm object to use the correct revision

            If by “correct revision” you just mean “the same revision I checked out somewhere earlier in the build”, then for multibranch Pipelines this is automatic when you do checkout scm. For simple projects using CpsScmFlowDefinition it is not possible due to limitations in the SCM API; it would be possible to provide an alternate FlowDefinition that uses scm-api, i.e. branch sources, and which provides the same guarantee of a consistent revision across calls to checkout scm.

            Show
            jglick Jesse Glick added a comment - modify scm object to use the correct revision If by “correct revision” you just mean “the same revision I checked out somewhere earlier in the build”, then for multibranch Pipelines this is automatic when you do checkout scm . For simple projects using CpsScmFlowDefinition it is not possible due to limitations in the SCM API; it would be possible to provide an alternate FlowDefinition that uses scm-api , i.e. branch sources, and which provides the same guarantee of a consistent revision across calls to checkout scm .
            Hide
            zaytsev_work Yury Zaytsev added a comment -

            > If by “correct revision” you just mean “the same revision I checked out somewhere earlier in the build”, then for multibranch Pipelines this is automatic when you do checkout scm.

            I'm very surprised to hear that. Multibranch pipeline project is exactly what I have. In my pipeline, I have multiple stages, which all do checkout scm for now, and inside each stage I have checkouts on multiple workers in parallel. The pipeline currently runs for an hour, or so, and if someone commits when the pipeline is already running, the checkout scm in the next stage picks up new commits, and not the commit with which the pipeline has been started.

            I want checkout scm to always checkout the commit which triggered the build, and not the branch which triggered the build, whatever the branch state is. Please see a screenshot attached...

            Show
            zaytsev_work Yury Zaytsev added a comment - > If by “correct revision” you just mean “the same revision I checked out somewhere earlier in the build”, then for multibranch Pipelines this is automatic when you do checkout scm. I'm very surprised to hear that. Multibranch pipeline project is exactly what I have. In my pipeline, I have multiple stages, which all do checkout scm for now, and inside each stage I have checkouts on multiple workers in parallel. The pipeline currently runs for an hour, or so, and if someone commits when the pipeline is already running, the checkout scm in the next stage picks up new commits, and not the commit with which the pipeline has been started. I want checkout scm to always checkout the commit which triggered the build, and not the branch which triggered the build, whatever the branch state is. Please see a screenshot attached...
            Hide
            zaytsev_work Yury Zaytsev added a comment -

            Just to clarify what you see on the screenshot: first it started building revision 3dc9d2b (1 commits since the last build), but then someone merged another branch while the pipeline was running, and checkout scm in the later stages picked up the new state 0825e24 (4 commits more), which is two merge commits away from the last build. Now, in the meantime, build #83 has been triggered with 0825e24, and both kept running in parallel, which, of course, doesn't make any sense.

            Ideally, I would like newer builds to abort previous ones as they get to the end of the stage, but, in the mean time, at least checkout scm should always checkout the same thing within one build.

            So, thank you for answering, but I can't see how what you're saying is correct.

            Show
            zaytsev_work Yury Zaytsev added a comment - Just to clarify what you see on the screenshot: first it started building revision 3dc9d2b (1 commits since the last build), but then someone merged another branch while the pipeline was running, and checkout scm in the later stages picked up the new state 0825e24 (4 commits more), which is two merge commits away from the last build. Now, in the meantime, build #83 has been triggered with 0825e24 , and both kept running in parallel, which, of course, doesn't make any sense. Ideally, I would like newer builds to abort previous ones as they get to the end of the stage, but, in the mean time, at least checkout scm should always checkout the same thing within one build. So, thank you for answering, but I can't see how what you're saying is correct.
            Hide
            jarosite aleksey savitskiy added a comment -

            why are you not using stash? checkout once, stash files, and then unstash in multiple times on nodes and stages.

            Show
            jarosite aleksey savitskiy added a comment - why are you not using stash? checkout once, stash files, and then unstash in multiple times on nodes and stages.
            Hide
            zaytsev_work Yury Zaytsev added a comment -

            aleksey savitskiy my repository is ~2G large and I have lots of small files in it. Very unfortunately, stash is simply not usable for anything beyond a couple of dozens of megabytes and hundreds of files.

            Show
            zaytsev_work Yury Zaytsev added a comment - aleksey savitskiy my repository is ~2G large and I have lots of small files in it. Very unfortunately, stash is simply not usable for anything beyond a couple of dozens of megabytes and hundreds of files.
            Hide
            jglick Jesse Glick added a comment -

            if someone commits when the pipeline is already running, the checkout scm in the next stage picks up new commits, and not the commit with which the pipeline has been started

            Then that is a bug, which should be filed separately with complete, self-contained steps to reproduce from scratch. The version consistency guarantee of checkout scm does have test coverage, including of course for Git.

            I want checkout scm to always checkout the commit which triggered the build

            Well there is not necessarily any such commit, or unique commit. What is guaranteed is that the repository revision from which Jenkinsfile was loaded whenever the build actually started running will match that of any subsequent checkout scm commands.

            Show
            jglick Jesse Glick added a comment - if someone commits when the pipeline is already running, the checkout scm in the next stage picks up new commits, and not the commit with which the pipeline has been started Then that is a bug, which should be filed separately with complete, self-contained steps to reproduce from scratch. The version consistency guarantee of checkout scm does have test coverage, including of course for Git. I want checkout scm to always checkout the commit which triggered the build Well there is not necessarily any such commit, or unique commit. What is guaranteed is that the repository revision from which Jenkinsfile was loaded whenever the build actually started running will match that of any subsequent checkout scm commands.
            Hide
            mcobden Marcus Cobden added a comment -

            I'm seeing the issue where `checkout scm` results in different commits between the start/end of a build; I've made a separate bug with a reproduction example: https://issues.jenkins-ci.org/browse/JENKINS-39508

            Show
            mcobden Marcus Cobden added a comment - I'm seeing the issue where `checkout scm` results in different commits between the start/end of a build; I've made a separate bug with a reproduction example: https://issues.jenkins-ci.org/browse/JENKINS-39508
            Hide
            jglick Jesse Glick added a comment -

            My running proposal FTR:

            For freestyle projects, there is ≤1 SCM, so we just set build-wide environment variables, and unless you are using the multi-SCM plugin which barely works, you are fine. For Pipeline, we could do the same if JENKINS-42499 were fixed, but the result will be useless for >1 (distinct) checkout. So while the core API might simply be widened to accept Run rather than AbstractBuild (JENKINS-24141), I would suggest having SCMStep return a Map<String,String> (perhaps) rather than set actual environment variables. Thus you could write, for example:

            def sha1 = checkout(scm).GIT_COMMIT
            
            Show
            jglick Jesse Glick added a comment - My running proposal FTR: For freestyle projects, there is ≤1 SCM , so we just set build-wide environment variables, and unless you are using the multi-SCM plugin which barely works, you are fine. For Pipeline, we could  do the same if JENKINS-42499 were fixed, but the result will be useless for >1 (distinct) checkout . So while the core API might simply be widened to accept Run  rather than AbstractBuild ( JENKINS-24141 ), I would suggest having SCMStep  return a Map<String,String>  (perhaps) rather than set actual environment variables. Thus you could write, for example: def sha1 = checkout(scm).GIT_COMMIT
            Hide
            abayer Andrew Bayer added a comment -

            fwiw, that'd still probably need buildEnvVars(Run,Map) anyway to get the map in the first place, wouldn't it? Just that we'd be returning the Map rather than adding it to an existing EnvVars.

            Show
            abayer Andrew Bayer added a comment - fwiw, that'd still probably need buildEnvVars(Run,Map) anyway to get the map in the first place, wouldn't it? Just that we'd be returning the Map rather than adding it to an existing EnvVars .
            Hide
            abayer Andrew Bayer added a comment -

            Actually, thinking about it more, maybe the right approach is to write off the legacy SCMs and just worry about implementations of SCMStep other than GenericSCMStep, offloading the decision as to whether to reuse code across about SomeSCM.buildEnvVars(AbstractBuild,Map) and SomeSCMStep.

            Show
            abayer Andrew Bayer added a comment - Actually, thinking about it more, maybe the right approach is to write off the legacy SCMs and just worry about implementations of SCMStep other than GenericSCMStep , offloading the decision as to whether to reuse code across about SomeSCM.buildEnvVars(AbstractBuild,Map) and SomeSCMStep .
            Hide
            jglick Jesse Glick added a comment -

            that'd still probably need buildEnvVars(Run,Map) anyway to get the map in the first place, wouldn't it?

            Correct, hence the dependency on this aspect of JENKINS-24141.

            just worry about implementations of SCMStep other than GenericSCMStep

            No. The other implementations are semi-deprecated. See JENKINS-37227.

            Show
            jglick Jesse Glick added a comment - that'd still probably need buildEnvVars(Run,Map) anyway to get the map in the first place, wouldn't it? Correct, hence the dependency on this aspect of JENKINS-24141 . just worry about implementations of SCMStep other than GenericSCMStep No. The other implementations are semi-deprecated. See  JENKINS-37227 .
            Hide
            abayer Andrew Bayer added a comment -

            Aaaah, gotcha.

            Show
            abayer Andrew Bayer added a comment - Aaaah, gotcha.
            Show
            abayer Andrew Bayer added a comment - Various PRs up - Core: https://github.com/jenkinsci/jenkins/pull/2730 Git: https://github.com/jenkinsci/git-plugin/pull/492 SCM step: https://github.com/jenkinsci/workflow-scm-step-plugin/pull/16
            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - SVN PR as well - https://github.com/jenkinsci/subversion-plugin/pull/182
            Hide
            abayer Andrew Bayer added a comment -
            Show
            abayer Andrew Bayer added a comment - And here's Mercurial - https://github.com/jenkinsci/mercurial-plugin/pull/102
            Hide
            abayer Andrew Bayer added a comment -

            FYI, adding a new withCheckout(scm) step as well:

            node {
                withCheckout(scm) {
                     echo "GIT_COMMIT is ${env.GIT_COMMIT}"
                }
            }
            
            Show
            abayer Andrew Bayer added a comment - FYI, adding a new withCheckout(scm) step as well: node { withCheckout(scm) { echo "GIT_COMMIT is ${env.GIT_COMMIT}" } }
            Hide
            jglick Jesse Glick added a comment -

            IIUC this is now Resolved/Fixed towards 2.60, right?

            Show
            jglick Jesse Glick added a comment - IIUC this is now Resolved/Fixed towards 2.60, right?
            Hide
            abayer Andrew Bayer added a comment -

            In core, yes, but not in the various SCMs and `workflow-scm-step`.

            Show
            abayer Andrew Bayer added a comment - In core, yes, but not in the various SCMs and `workflow-scm-step`.
            Hide
            jglick Jesse Glick added a comment -

            Right, point taken.

            Show
            jglick Jesse Glick added a comment - Right, point taken.
            Hide
            jglick Jesse Glick added a comment -

            workflow-job 2.12 has some of this.

            Show
            jglick Jesse Glick added a comment - workflow-job 2.12 has some of this.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/hudson/plugins/mercurial/MercurialSCM.java
            http://jenkins-ci.org/commit/mercurial-plugin/3592fa40faec68409cda8a05818a4bb853d7da7d
            Log:
            JENKINS-26100 Change buildEnvVars to take Run

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/hudson/plugins/mercurial/MercurialSCM.java http://jenkins-ci.org/commit/mercurial-plugin/3592fa40faec68409cda8a05818a4bb853d7da7d Log: JENKINS-26100 Change buildEnvVars to take Run
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            pom.xml
            src/main/java/hudson/plugins/mercurial/MercurialSCM.java
            http://jenkins-ci.org/commit/mercurial-plugin/5cc6e1c2b06b57cfa336a781b94bd9db76a0909c
            Log:
            Merge pull request #102 from abayer/jenkins-26100

            JENKINS-26100 Change buildEnvVars to take Run

            Compare: https://github.com/jenkinsci/mercurial-plugin/compare/07ff1c76d51a...5cc6e1c2b06b

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: pom.xml src/main/java/hudson/plugins/mercurial/MercurialSCM.java http://jenkins-ci.org/commit/mercurial-plugin/5cc6e1c2b06b57cfa336a781b94bd9db76a0909c Log: Merge pull request #102 from abayer/jenkins-26100 JENKINS-26100 Change buildEnvVars to take Run Compare: https://github.com/jenkinsci/mercurial-plugin/compare/07ff1c76d51a...5cc6e1c2b06b
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Joseph
            Path:
            pom.xml
            src/main/java/hudson/plugins/accurev/AccurevSCM.java
            src/main/java/hudson/plugins/accurev/delegates/AbstractModeDelegate.java
            src/main/java/hudson/plugins/accurev/delegates/ReftreeDelegate.java
            src/main/java/hudson/plugins/accurev/delegates/WorkspaceDelegate.java
            src/test/java/hudson/plugins/accurev/AccurevSCMTest.java
            http://jenkins-ci.org/commit/accurev-plugin/5e3008ecc47a6f31930e81223f2b5699121f31cb
            Log:
            JENKINS-26100 Change buildEnvVars to take Run (#55)

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Joseph Path: pom.xml src/main/java/hudson/plugins/accurev/AccurevSCM.java src/main/java/hudson/plugins/accurev/delegates/AbstractModeDelegate.java src/main/java/hudson/plugins/accurev/delegates/ReftreeDelegate.java src/main/java/hudson/plugins/accurev/delegates/WorkspaceDelegate.java src/test/java/hudson/plugins/accurev/AccurevSCMTest.java http://jenkins-ci.org/commit/accurev-plugin/5e3008ecc47a6f31930e81223f2b5699121f31cb Log: JENKINS-26100 Change buildEnvVars to take Run (#55)
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/hudson/scm/SubversionSCM.java
            src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java
            src/test/java/hudson/scm/SubversionSCMUnitTest.java
            http://jenkins-ci.org/commit/subversion-plugin/7696afda51bf2b5cd9a835ccb5014b0eef8dca24
            Log:
            JENKINS-26100 Change buildEnvVars to Run.

            NOTE: Findbugs is disabled due to the fact that there are 33 freakin'
            findbugs warnings that cause the whole build to error out, and fixing
            them is going to take a non-trivial amount of refactoring. I may well
            come back to that in this PR, but it may need to wait for another PR.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/hudson/scm/SubversionSCM.java src/main/java/jenkins/scm/impl/subversion/SubversionSCMSource.java src/test/java/hudson/scm/SubversionSCMUnitTest.java http://jenkins-ci.org/commit/subversion-plugin/7696afda51bf2b5cd9a835ccb5014b0eef8dca24 Log: JENKINS-26100 Change buildEnvVars to Run. NOTE: Findbugs is disabled due to the fact that there are 33 freakin' findbugs warnings that cause the whole build to error out, and fixing them is going to take a non-trivial amount of refactoring. I may well come back to that in this PR, but it may need to wait for another PR.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            src/main/java/hudson/scm/SubversionSCM.java
            src/test/java/hudson/scm/SubversionSCMUnitTest.java
            http://jenkins-ci.org/commit/subversion-plugin/0613ef35111ca2fb2e9ed5021524c6c23282e748
            Log:
            Merge pull request #182 from abayer/jenkins-26100

            JENKINS-26100 Change buildEnvVars to Run.

            Compare: https://github.com/jenkinsci/subversion-plugin/compare/1ba217661b47...0613ef35111c

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: src/main/java/hudson/scm/SubversionSCM.java src/test/java/hudson/scm/SubversionSCMUnitTest.java http://jenkins-ci.org/commit/subversion-plugin/0613ef35111ca2fb2e9ed5021524c6c23282e748 Log: Merge pull request #182 from abayer/jenkins-26100 JENKINS-26100 Change buildEnvVars to Run. Compare: https://github.com/jenkinsci/subversion-plugin/compare/1ba217661b47...0613ef35111c
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java
            src/test/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStepTest.java
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/cf36f5b5daa78f8fc4480328c5ac6ac6b4841032
            Log:
            JENKINS-26100 Return a map of SCM-contributed variables

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java src/test/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStepTest.java http://jenkins-ci.org/commit/workflow-scm-step-plugin/cf36f5b5daa78f8fc4480328c5ac6ac6b4841032 Log: JENKINS-26100 Return a map of SCM-contributed variables
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java
            src/main/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep.java
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/config.jelly
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/help.html
            src/test/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStepTest.java
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/bec924c64a8f19efbd7f6f08af9d879636dcf4e4
            Log:
            JENKINS-26100 Add withCheckout(scm)

            { body }

            step.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java src/main/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep.java src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/help.html src/test/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStepTest.java http://jenkins-ci.org/commit/workflow-scm-step-plugin/bec924c64a8f19efbd7f6f08af9d879636dcf4e4 Log: JENKINS-26100 Add withCheckout(scm) { body } step.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java
            src/main/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep.java
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/config.jelly
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/help.html
            src/test/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStepTest.java
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/dbcfe52ad81d16fe3dfdc5ce642f49720aff36e3
            Log:
            Revert "JENKINS-26100 Add withCheckout(scm)

            { body }

            step."

            This reverts commit bec924c64a8f19efbd7f6f08af9d879636dcf4e4.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java src/main/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep.java src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/config.jelly src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStep/help.html src/test/java/org/jenkinsci/plugins/workflow/steps/scm/WithCheckoutStepTest.java http://jenkins-ci.org/commit/workflow-scm-step-plugin/dbcfe52ad81d16fe3dfdc5ce642f49720aff36e3 Log: Revert " JENKINS-26100 Add withCheckout(scm) { body } step." This reverts commit bec924c64a8f19efbd7f6f08af9d879636dcf4e4.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/test/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStepTest.java
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/65952d9ba01c2d79d41d3c5c32cbc22580df1b03
            Log:
            Switch to using svn for JENKINS-26100 test so we can release.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/test/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStepTest.java http://jenkins-ci.org/commit/workflow-scm-step-plugin/65952d9ba01c2d79d41d3c5c32cbc22580df1b03 Log: Switch to using svn for JENKINS-26100 test so we can release.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            Jenkinsfile
            pom.xml
            src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.html
            src/test/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStepTest.java
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/2d2c718cb1c1b75d791c4e858571fdc9fa1b3951
            Log:
            Merge pull request #16 from abayer/jenkins-26100

            JENKINS-26100 Return a map of SCM-contributed variables

            Compare: https://github.com/jenkinsci/workflow-scm-step-plugin/compare/6b6716f56d97...2d2c718cb1c1

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: Jenkinsfile pom.xml src/main/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStep.java src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.html src/test/java/org/jenkinsci/plugins/workflow/steps/scm/SCMStepTest.java http://jenkins-ci.org/commit/workflow-scm-step-plugin/2d2c718cb1c1b75d791c4e858571fdc9fa1b3951 Log: Merge pull request #16 from abayer/jenkins-26100 JENKINS-26100 Return a map of SCM-contributed variables Compare: https://github.com/jenkinsci/workflow-scm-step-plugin/compare/6b6716f56d97...2d2c718cb1c1
            Hide
            abayer Andrew Bayer added a comment -

            Waiting to actually resolve until https://github.com/jenkinsci/git-plugin/pull/492 is merged/released.

            Show
            abayer Andrew Bayer added a comment - Waiting to actually resolve until https://github.com/jenkinsci/git-plugin/pull/492 is merged/released.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pom.xml
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/47f738c54c6e8f5ead678aacfda1faa1d7433db8
            Log:
            JENKINS-26100 Switch buildEnvVars and others to Run

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pom.xml src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/47f738c54c6e8f5ead678aacfda1faa1d7433db8 Log: JENKINS-26100 Switch buildEnvVars and others to Run
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Mark Waite
            Path:
            pom.xml
            src/main/java/hudson/plugins/git/GitSCM.java
            http://jenkins-ci.org/commit/git-plugin/907253d7149fdd53de3389528e163be8b5e298ef
            Log:
            Merge pull request #492 from abayer/jenkins-26100

            JENKINS-26100 Switch buildEnvVars and others to Run

            Compare: https://github.com/jenkinsci/git-plugin/compare/79c66ebb8958...907253d7149f

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: pom.xml src/main/java/hudson/plugins/git/GitSCM.java http://jenkins-ci.org/commit/git-plugin/907253d7149fdd53de3389528e163be8b5e298ef Log: Merge pull request #492 from abayer/jenkins-26100 JENKINS-26100 Switch buildEnvVars and others to Run Compare: https://github.com/jenkinsci/git-plugin/compare/79c66ebb8958...907253d7149f
            Hide
            jglick Jesse Glick added a comment -

            I think at this point everything is merged, and only git plugin changes are still awaiting release.

            Show
            jglick Jesse Glick added a comment - I think at this point everything is merged, and only git plugin changes are still awaiting release.
            Hide
            markewaite Mark Waite added a comment -

            Git plugin 3.3.1 has been released with the necessary pull request merged.

            Show
            markewaite Mark Waite added a comment - Git plugin 3.3.1 has been released with the necessary pull request merged.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            src/main/resources/hudson/plugins/git/GitSCM/buildEnv.groovy
            src/main/resources/hudson/plugins/git/GitSCM/buildEnv.properties
            http://jenkins-ci.org/commit/git-plugin/53984ad06a8d8a38cce1857e977006a0adbd3e13
            Log:
            JENKINS-26100 Supply GitSCM/buildEnv.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/resources/hudson/plugins/git/GitSCM/buildEnv.groovy src/main/resources/hudson/plugins/git/GitSCM/buildEnv.properties http://jenkins-ci.org/commit/git-plugin/53984ad06a8d8a38cce1857e977006a0adbd3e13 Log: JENKINS-26100 Supply GitSCM/buildEnv.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Mark Waite
            Path:
            src/main/java/hudson/plugins/git/GitSCM.java
            src/main/resources/hudson/plugins/git/GitSCM/buildEnv.groovy
            src/main/resources/hudson/plugins/git/GitSCM/buildEnv.properties
            http://jenkins-ci.org/commit/git-plugin/2cfbf64ed55f9a23ccd576c66fa4deb83dabe91a
            Log:
            Merge pull request #508 from jglick/buildEnv

            JENKINS-26100 Supply GitSCM/buildEnv

            Compare: https://github.com/jenkinsci/git-plugin/compare/87a76efafa62...2cfbf64ed55f

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/resources/hudson/plugins/git/GitSCM/buildEnv.groovy src/main/resources/hudson/plugins/git/GitSCM/buildEnv.properties http://jenkins-ci.org/commit/git-plugin/2cfbf64ed55f9a23ccd576c66fa4deb83dabe91a Log: Merge pull request #508 from jglick/buildEnv JENKINS-26100 Supply GitSCM/buildEnv Compare: https://github.com/jenkinsci/git-plugin/compare/87a76efafa62...2cfbf64ed55f
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.html
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.jelly
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/0008adc79cb5617971d5447c463d2ca1a0799e10
            Log:
            JENKINS-26100 Display buildEnv views of available SCM installations.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.html src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.jelly http://jenkins-ci.org/commit/workflow-scm-step-plugin/0008adc79cb5617971d5447c463d2ca1a0799e10 Log: JENKINS-26100 Display buildEnv views of available SCM installations.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.html
            src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.jelly
            http://jenkins-ci.org/commit/workflow-scm-step-plugin/9ccae57a8d5b746e10dfcdc3f44400729d7da27f
            Log:
            Merge pull request #18 from jglick/doc-JENKINS-26100

            JENKINS-26100 Display buildEnv views of available SCM installations

            Compare: https://github.com/jenkinsci/workflow-scm-step-plugin/compare/17a9946bfe3f...9ccae57a8d5b

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.html src/main/resources/org/jenkinsci/plugins/workflow/steps/scm/GenericSCMStep/help.jelly http://jenkins-ci.org/commit/workflow-scm-step-plugin/9ccae57a8d5b746e10dfcdc3f44400729d7da27f Log: Merge pull request #18 from jglick/doc- JENKINS-26100 JENKINS-26100 Display buildEnv views of available SCM installations Compare: https://github.com/jenkinsci/workflow-scm-step-plugin/compare/17a9946bfe3f...9ccae57a8d5b
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            http://jenkins-ci.org/commit/workflow-cps-plugin/1a69342650bd1846d479c296436bb8969559ca16
            Log:
            JENKINS-26100 Updating documentation.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/1a69342650bd1846d479c296436bb8969559ca16 Log: JENKINS-26100 Updating documentation.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly
            http://jenkins-ci.org/commit/workflow-cps-plugin/2e9b83495d9aa91dca4479f03c35daaeb275b22f
            Log:
            Merge pull request #153 from jglick/doc-JENKINS-26100

            JENKINS-26100 Updating documentation

            Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/b78991523e2f...2e9b83495d9a

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/org/jenkinsci/plugins/workflow/cps/EnvActionImpl/Binder/help.jelly http://jenkins-ci.org/commit/workflow-cps-plugin/2e9b83495d9aa91dca4479f03c35daaeb275b22f Log: Merge pull request #153 from jglick/doc- JENKINS-26100 JENKINS-26100 Updating documentation Compare: https://github.com/jenkinsci/workflow-cps-plugin/compare/b78991523e2f...2e9b83495d9a
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.groovy
            src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.properties
            http://jenkins-ci.org/commit/mercurial-plugin/16fb1feb2499c01f4f44117d96691f508c00f10f
            Log:
            JENKINS-26100 Supply MercurialSCM/buildEnv.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.groovy src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.properties http://jenkins-ci.org/commit/mercurial-plugin/16fb1feb2499c01f4f44117d96691f508c00f10f Log: JENKINS-26100 Supply MercurialSCM/buildEnv.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.groovy
            src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.properties
            http://jenkins-ci.org/commit/mercurial-plugin/8e0581ac7045aedfd2f34ea6fa01d90618df6b3c
            Log:
            Merge pull request #104 from jglick/buildEnv

            JENKINS-26100 Supply MercurialSCM/buildEnv

            Compare: https://github.com/jenkinsci/mercurial-plugin/compare/bfc7cbd995af...8e0581ac7045

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.groovy src/main/resources/hudson/plugins/mercurial/MercurialSCM/buildEnv.properties http://jenkins-ci.org/commit/mercurial-plugin/8e0581ac7045aedfd2f34ea6fa01d90618df6b3c Log: Merge pull request #104 from jglick/buildEnv JENKINS-26100 Supply MercurialSCM/buildEnv Compare: https://github.com/jenkinsci/mercurial-plugin/compare/bfc7cbd995af...8e0581ac7045
            Hide
            leedega Kevin Phillips added a comment -

            So, I am a bit confused here. This ticket has been resolved but I'm not sure what combination of versions (core, plugins, etc.) are needed in order to make this work. Could someone clarify those particulars?

            Show
            leedega Kevin Phillips added a comment - So, I am a bit confused here. This ticket has been resolved but I'm not sure what combination of versions (core, plugins, etc.) are needed in order to make this work. Could someone clarify those particulars?
            Hide
            markewaite Mark Waite added a comment -

            Git plugin 3.4.1 includes the necessary change, though JENKINS-45489 shows that some of the entries in the returned map seem to include incorrect data. JENKINS-45489 includes more details of the testing and could also be used as an example of how to read the information.

            I don't know the versions of the other SCM plugins which have that capability.

            Show
            markewaite Mark Waite added a comment - Git plugin 3.4.1 includes the necessary change, though JENKINS-45489 shows that some of the entries in the returned map seem to include incorrect data. JENKINS-45489 includes more details of the testing and could also be used as an example of how to read the information. I don't know the versions of the other SCM plugins which have that capability.
            Hide
            leedega Kevin Phillips added a comment -

            Hmmm - I have Git plugin v3.4.1 installed, but the following snippet of code returns 'null'. Am I doing something wrong?

             

            node {
                def retval = checkout (changelog: true, poll: true, scm: [$class: 'GitSCM', ... other params for the git checkout])
                echo retval.toString()   // <--- prints 'null'
            }
            
            Show
            leedega Kevin Phillips added a comment - Hmmm - I have Git plugin v3.4.1 installed, but the following snippet of code returns 'null'. Am I doing something wrong?   node {     def retval = checkout (changelog: true , poll: true , scm: [$class: 'GitSCM' , ... other params for the git checkout])     echo retval.toString()   // <--- prints ' null ' }
            Hide
            markewaite Mark Waite added a comment -

            I don't know how groovy .toString() of a map behaves. The retval is a map. You can see an example of the check I'm running in my test pipeline, if that helps

            Show
            markewaite Mark Waite added a comment - I don't know how groovy .toString() of a map behaves. The retval is a map. You can see an example of the check I'm running in my test pipeline, if that helps
            Hide
            leedega Kevin Phillips added a comment -

            Yeah, that's why I asked. It looks like my snippet from above should work but it doesn't so something on my system must need to be updated or something. I'd like to know which bits I'm missing to make it work.

            Just to be clear, the return value from checkout() is actually null on my system, so it has nothing to do with the toString() method. Here's a variation to illustrate:

             

            node {
                def retval = checkout (...)
                if (retval == null) echo "Undefined"
            }

            This snippet prints out "Undefined" in the log.

            Show
            leedega Kevin Phillips added a comment - Yeah, that's why I asked. It looks like my snippet from above should work but it doesn't so something on my system must need to be updated or something. I'd like to know which bits I'm missing to make it work. Just to be clear, the return value from checkout() is actually null on my system, so it has nothing to do with the toString() method. Here's a variation to illustrate:   node { def retval = checkout (...) if (retval == null ) echo "Undefined" } This snippet prints out "Undefined" in the log.
            Hide
            romanp Roman Pickl added a comment -

            just wanted to add that

            GIT_REV=checkout(scm).GIT_COMMIT

            works for us when run as part of a declarative pipeline within script{}

            Show
            romanp Roman Pickl added a comment - just wanted to add that GIT_REV=checkout(scm).GIT_COMMIT works for us when run as part of a declarative pipeline within script{}
            Hide
            markewaite Mark Waite added a comment -

            Kevin Phillips, my working sample is using scripted pipeline. Since Roman Pickl's working sample is using declarative, I'm confident it works in both cases with the latest plugin versions.

            I run my tests using the plugin versions stored in my lts-with-plugins repository. If you'd like to compare versions, you could clone that repository (you'll need git lfs, since it is LFS enabled).

            Show
            markewaite Mark Waite added a comment - Kevin Phillips , my working sample is using scripted pipeline. Since Roman Pickl 's working sample is using declarative, I'm confident it works in both cases with the latest plugin versions. I run my tests using the plugin versions stored in my lts-with-plugins repository . If you'd like to compare versions, you could clone that repository (you'll need git lfs, since it is LFS enabled).
            Hide
            leedega Kevin Phillips added a comment -

            Mark Waite Roman Pickl What version of the jenkins core are you both using? I'm currently on LTS v2.46.3. Maybe there is some feature in a newer core version that is required to make this work as well.

            Show
            leedega Kevin Phillips added a comment - Mark Waite Roman Pickl  What version of the jenkins core are you both using? I'm currently on LTS v2.46.3. Maybe there is some feature in a newer core version that is required to make this work as well.
            Hide
            markewaite Mark Waite added a comment -

            I doubt the differences between Jenkins 2.46.3 (the prior LTS) and 2.60.2 (the current LTS and the version I'm using) are enough to matter here. Have you checked your plugins for upgrades?

            Show
            markewaite Mark Waite added a comment - I doubt the differences between Jenkins 2.46.3 (the prior LTS) and 2.60.2 (the current LTS and the version I'm using) are enough to matter here. Have you checked your plugins for upgrades?
            Hide
            leedega Kevin Phillips added a comment -

            Yes, I updated the Git plugin and all pipeline* plugins to the latest version yesterday to try and get this working. This is what prompted me to post my original question. I can try upgrading the Jenkins core on one of my sandboxes just to see if that makes any difference just in case.

            Show
            leedega Kevin Phillips added a comment - Yes, I updated the Git plugin and all pipeline* plugins to the latest version yesterday to try and get this working. This is what prompted me to post my original question. I can try upgrading the Jenkins core on one of my sandboxes just to see if that makes any difference just in case.
            Hide
            jglick Jesse Glick added a comment -

            You need Jenkins core 2.60 or later. Messaging has been added to the checkout step’s inline help already.

            Show
            jglick Jesse Glick added a comment - You need Jenkins core 2.60 or later. Messaging has been added to the checkout step’s inline help already.
            Hide
            romanp Roman Pickl added a comment -

            we are running Jenkins ver. 2.60.2

            Show
            romanp Roman Pickl added a comment - we are running Jenkins ver. 2.60.2
            Hide
            hariharan Hariharan Kuppusamy added a comment -

            With above changes, will it be possible to get the Environment list in the following way,

            <snip>

            Run run;

            EnvVars env = run.getEnvironment(listener);

            env.get("GIT_URL");

            </snip>

             

            Show
            hariharan Hariharan Kuppusamy added a comment - With above changes, will it be possible to get the Environment list in the following way, <snip> Run run; EnvVars env = run.getEnvironment(listener); env.get("GIT_URL"); </snip>  
            Hide
            markewaite Mark Waite added a comment -

            Hariharan Kuppusamy The environment variables are returned by the pipeline checkout command as a map

            def map_of_checkout_vars = checkout([$class: 'GitSCM'])
            

            Refer to my Jenkinsfile for an example using those variables.

            Show
            markewaite Mark Waite added a comment - Hariharan Kuppusamy The environment variables are returned by the pipeline checkout command as a map def map_of_checkout_vars = checkout([$class: 'GitSCM']) Refer to my Jenkinsfile for an example using those variables.
            Hide
            slapersonne Simon La Personne added a comment - - edited

            Hello,

            I have the same issue than Kevin Phillips, with Jenkins 2.60.2 and Git plugin 3.5.0 : checkout command does not return anything.

            Is an other plugin needed to recover and process these variables ?

            Show
            slapersonne Simon La Personne added a comment - - edited Hello, I have the same issue than Kevin Phillips , with Jenkins 2.60.2 and Git plugin 3.5.0 : checkout command does not return anything. Is an other plugin needed to recover and process these variables ?
            Hide
            markewaite Mark Waite added a comment -

            Simon La Personne I'm using Jenkins 2.60.2 with the plugins listed in my lts-with-plugin repository. You could compare your plugin list to those plugins to detect differences.

            Show
            markewaite Mark Waite added a comment - Simon La Personne I'm using Jenkins 2.60.2 with the plugins listed in my lts-with-plugin repository . You could compare your plugin list to those plugins to detect differences.
            Hide
            jglick Jesse Glick added a comment - - edited

            You need to update workflow-scm-step.

            Show
            jglick Jesse Glick added a comment - - edited You need to update workflow-scm-step .
            Hide
            slapersonne Simon La Personne added a comment -

            Thank you for your answers, with workflow-scm-step updated to 2.6 the variables can well be recovered within the map.

            Show
            slapersonne Simon La Personne added a comment - Thank you for your answers, with workflow-scm-step updated to 2.6 the variables can well be recovered within the map.
            Hide
            rainwaj Justin Rainwater added a comment -

            Jesse Glick

            Hello, I had this support ticket https://support.cloudbees.com/hc/en-us/requests/47538 marked as resolved based on the work done to resolve this issue. My request was for pipeline to support GHPRB style "skip build phrase". Forgive me but it's not obvious how I would leverage the fix for this issue to give me the "skip build phrase" type functionality. Could you give some pointers on that?

            Thanks

            Show
            rainwaj Justin Rainwater added a comment - Jesse Glick Hello, I had this support ticket  https://support.cloudbees.com/hc/en-us/requests/47538  marked as resolved based on the work done to resolve this issue. My request was for pipeline to support GHPRB style "skip build phrase". Forgive me but it's not obvious how I would leverage the fix for this issue to give me the "skip build phrase" type functionality. Could you give some pointers on that? Thanks
            Hide
            markewaite Mark Waite added a comment -

            Justin Rainwater I assume they were thinking that one or more of the values in the map returned from the pipeline checkout() step could be used inside your pipeline script. The names include the GIT_COMMIT, GIT_AUTHOR, and GIT_AUTHOR, and the associated values come from the most recent commit on that branch.

            I think they intended that you would use those values to decide if the pipeline should finish early, rather than continuing through to the end of the pipeline.

            Show
            markewaite Mark Waite added a comment - Justin Rainwater I assume they were thinking that one or more of the values in the map returned from the pipeline checkout() step could be used inside your pipeline script. The names include the GIT_COMMIT, GIT_AUTHOR, and GIT_AUTHOR, and the associated values come from the most recent commit on that branch. I think they intended that you would use those values to decide if the pipeline should finish early, rather than continuing through to the end of the pipeline.
            Hide
            rainwaj Justin Rainwater added a comment -

            Thanks for the reply Mark Waite. Do you happen to know if checkout() is also returning the PR title/description and/or comments? I think that's the only way this new functionality could provide the same value as "Skip Build Phrase" from GHPRB.

            Show
            rainwaj Justin Rainwater added a comment - Thanks for the reply Mark Waite . Do you happen to know if checkout() is also returning the PR title/description and/or comments? I think that's the only way this new functionality could provide the same value as "Skip Build Phrase" from GHPRB.
            Hide
            markewaite Mark Waite added a comment -

            Justin Rainwater I know that it is not returning any pull request specific information (at least not at this time). It returns information about the commit and its branch, not about the pull request.

            Show
            markewaite Mark Waite added a comment - Justin Rainwater I know that it is not returning any pull request specific information (at least not at this time). It returns information about the commit and its branch, not about the pull request.
            Hide
            gotson Gauthier R. added a comment -

            Hello, i asked a question on StackOverflow, i am using JGit and cannot get any information from scm checkout using the latest version of the plugin.

            Would you know if this is a limitation of JGit itself, or from the SCM steps plugin ?

            Show
            gotson Gauthier R. added a comment - Hello, i asked a question on StackOverflow , i am using JGit and cannot get any information from scm checkout using the latest version of the plugin. Would you know if this is a limitation of JGit itself, or from the SCM steps plugin ?
            Hide
            markewaite Mark Waite added a comment -

            Gauthier R. in your stackoverflow question, you mention that you're running git plugin 3.3.0. The fix was not included in the git plugin until 3.3.2. You'll need to update to at least git plugin 3.3.2.

            Show
            markewaite Mark Waite added a comment - Gauthier R. in your stackoverflow question, you mention that you're running git plugin 3.3.0. The fix was not included in the git plugin until 3.3.2. You'll need to update to at least git plugin 3.3.2.
            Hide
            gotson Gauthier R. added a comment -

            Mark Waite thanks a lot for your help, upgrading the Git Plugin to 3.3.2 indeed solved my problem !

            Show
            gotson Gauthier R. added a comment - Mark Waite thanks a lot for your help, upgrading the Git Plugin to 3.3.2 indeed solved my problem !

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                jglick Jesse Glick
              • Votes:
                85 Vote for this issue
                Watchers:
                101 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: