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

Allow to specify node for load from SCM (Jenkinsfile)

    XMLWordPrintable

Details

    Description

      Currently SCM checkout is done on master. This requires the master to have SCM tool installed. Add ability to specify node for Pipeline SCM checkout (Jenkinsfile).

      Attachments

        Issue Links

          Activity

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java
            http://jenkins-ci.org/commit/workflow-cps-plugin/e162da74637040ccd0b9623290b8597da1a8e513
            Log:
            Removing TODO comment filed as JENKINS-34140.

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinition.java http://jenkins-ci.org/commit/workflow-cps-plugin/e162da74637040ccd0b9623290b8597da1a8e513 Log: Removing TODO comment filed as JENKINS-34140 .
            jglick Jesse Glick added a comment -

            The code change seems easy, but the security implications are worrisome. Anyway JENKINS-33273 would render this sort of obsolete to the extent that compliant SCM integrations would not require any checkout for Jenkinsfile. For SCMs which do not have any way of retrieving file contents remotely, or which do not have a Java client, the problem may remain.

            jglick Jesse Glick added a comment - The code change seems easy, but the security implications are worrisome. Anyway JENKINS-33273 would render this sort of obsolete to the extent that compliant SCM integrations would not require any checkout for Jenkinsfile . For SCMs which do not have any way of retrieving file contents remotely, or which do not have a Java client, the problem may remain.
            eliwhite Eli White added a comment - This seems similar to https://issues.jenkins-ci.org/browse/JENKINS-35710
            jglick Jesse Glick added a comment -

            JENKINS-35710 that is. Not really.

            jglick Jesse Glick added a comment - JENKINS-35710 that is. Not really.
            jglick Jesse Glick added a comment -

            Lesser importance after JENKINS-33273.

            jglick Jesse Glick added a comment - Lesser importance after  JENKINS-33273 .

            Hi Owen,

            I'm checking out code on a specific node like this:

             

            pipeline {
               environment {
                  mvnHome = tool 'maven-3.0.5'
                  mvn_version = 'maven-3.0.5'
               }
            
               agent none
            
               options {
                  buildDiscarder(logRotator(numToKeepStr: '30', artifactNumToKeepStr: '30'))
                  retry(2)
                  skipDefaultCheckout()
               }
            
               stages {
                  stage('build') {
                  agent {
                     node {
                        label 'xxxx'
                        customWorkspace 'xxxxxxxxxxx-ws'
                     }
                  }
            
                  steps {
                     checkout([$class: 'SubversionSCM', additionalCredentials: [], 
                        excludedCommitMessages: '', excludedRegions: '', excludedRevprop: '',
                        excludedUsers: '', 
                        filterChangelog: false, ignoreDirPropChanges: false, 
                        includedRegions: '', 
                        locations: [], workspaceUpdater: [$class: 'UpdateWithCleanUpdater']])
            
                     // Name the build after the product version. Also include the build 
                     // machine as a debugging aid.
                     echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}"
            
            

            The key here is skipDefaultCheckout().

            Does this meet what you're trying to do?

            Kind Regards,

            Johnny

            johnstosh John Muczynski added a comment - Hi Owen, I'm checking out code on a specific node like this:   pipeline { environment {   mvnHome = tool 'maven-3.0.5' mvn_version = 'maven-3.0.5' } agent none options { buildDiscarder(logRotator(numToKeepStr: '30' , artifactNumToKeepStr: '30' )) retry(2) skipDefaultCheckout() } stages { stage( 'build' ) { agent { node { label 'xxxx' customWorkspace 'xxxxxxxxxxx-ws' } } steps { checkout([$class: 'SubversionSCM' , additionalCredentials: [], excludedCommitMessages: '', excludedRegions: ' ', excludedRevprop: ' ', excludedUsers: '', filterChangelog: false , ignoreDirPropChanges: false , includedRegions: '', locations: [], workspaceUpdater: [$class: 'UpdateWithCleanUpdater' ]]) // Name the build after the product version. Also include the build // machine as a debugging aid. echo "Running BUILD_ID ${env.BUILD_ID} on NODE_NAME ${env.NODE_NAME}" The key here is skipDefaultCheckout(). Does this meet what you're trying to do? Kind Regards, Johnny
            abayer Andrew Bayer added a comment -

            No, that just skips the automatic checkout on the agent. This ticket is about where the Jenkinsfile gets read in the first place - which is just on master.

            abayer Andrew Bayer added a comment - No, that just skips the automatic checkout on the agent. This ticket is about where the Jenkinsfile gets read in the first place - which is just on master.

            People

              Unassigned Unassigned
              owood Owen Wood
              Votes:
              2 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: