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

Workflow support for Copy to Slave plugin

    Details

    • Similar Issues:

      Description

      CopyToSlaveBuildWrapper looks like it could be made compatible with Workflow (implement SimpleBuildWrapper) without major refactoring. (Unclear to me why this is a BuildWrapper rather than a Builder.) Similarly, CopyToMasterNotifier could be made to implement SimpleBuildStep. (Again unclear why this is a Publisher rather than a Builder.)

        Attachments

          Activity

          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          COMPATIBILITY.md
          http://jenkins-ci.org/commit/workflow-plugin/b07c6a491c37edd69162c3be75bf22fa43066356
          Log:
          JENKINS-28386 Noting.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: COMPATIBILITY.md http://jenkins-ci.org/commit/workflow-plugin/b07c6a491c37edd69162c3be75bf22fa43066356 Log: JENKINS-28386 Noting.
          Hide
          jglick Jesse Glick added a comment -

          Probable workaround (untested):

          node('master') {
            dir('/path/on/master/1') {
              stash 'master-stuff'
            }
          }
          node('slave') {
            dir('/path/on/slave/1') {
              unstash 'master-stuff'
            }
            dir('/path/on/slave/2') {
              stash 'slave-stuff'
            }
          }
          node('master') {
            dir('/path/on/master/2') {
              unstash 'slave-stuff'
            }
          }
          

          Note that this requires an executor on the master. Which is probably a good thing: in a secured Jenkins instance, there should be none, which would prevent someone from abusing this system to steal secrets from the master.

          Show
          jglick Jesse Glick added a comment - Probable workaround (untested): node( 'master' ) { dir( '/path/on/master/1' ) { stash 'master-stuff' } } node( 'slave' ) { dir( '/path/on/slave/1' ) { unstash 'master-stuff' } dir( '/path/on/slave/2' ) { stash 'slave-stuff' } } node( 'master' ) { dir( '/path/on/master/2' ) { unstash 'slave-stuff' } } Note that this requires an executor on the master. Which is probably a good thing: in a secured Jenkins instance, there should be none, which would prevent someone from abusing this system to steal secrets from the master.
          Hide
          mcrooney mcrooney added a comment - - edited

          Thanks Jesse Glick, that is a great work-around! It almost seems like Pipeline has this feature natively and perhaps this plugin support isn't needed? I couldn't seem to get it to stash something outside of the workspace (either by putting absolute paths or relative ../../ paths), and copy-to-slave prefers to copy things from userContent, so the work-around for me was to do something like this:

          node('master') {
            sh "ln -sf ${env.JENKINS_HOME}/userContent ."
            stash includes: "userContent/foo/*", name: "master-stuff"
          }
          node('slave') {
            unstash 'master-stuff"
            sh "ls userContent/foo"
          }
          
          Show
          mcrooney mcrooney added a comment - - edited Thanks Jesse Glick , that is a great work-around! It almost seems like Pipeline has this feature natively and perhaps this plugin support isn't needed? I couldn't seem to get it to stash something outside of the workspace (either by putting absolute paths or relative ../../ paths), and copy-to-slave prefers to copy things from userContent, so the work-around for me was to do something like this: node( 'master' ) { sh "ln -sf ${env.JENKINS_HOME}/userContent ." stash includes: "userContent/foo/*" , name: "master-stuff" } node( 'slave' ) { unstash 'master-stuff" sh "ls userContent/foo" }
          Hide
          jglick Jesse Glick added a comment -

          I will not offer advice on anything that involves nonzero master executors, which is inherently dangerous and unsupportable.

          Show
          jglick Jesse Glick added a comment - I will not offer advice on anything that involves nonzero master executors, which is inherently dangerous and unsupportable.
          Hide
          mcrooney mcrooney added a comment -

          That makes sense for public Jenkins; I don't see anything inherently dangerous about this in a Jenkins with authentication inside an intranet/VPC (though I agree it is less secure). Regardless, you can also accomplish a similar thing by running a separate agent on the master with a different user or in a container, and thus having the unix security model to isolate things as desired. This would allow you to Stash world-readable files on the master without exposing secrets, unless there are other concerns I'm not aware of, which I fully admit there might be.

          Show
          mcrooney mcrooney added a comment - That makes sense for public Jenkins; I don't see anything inherently dangerous about this in a Jenkins with authentication inside an intranet/VPC (though I agree it is less secure). Regardless, you can also accomplish a similar thing by running a separate agent on the master with a different user or in a container, and thus having the unix security model to isolate things as desired. This would allow you to Stash world-readable files on the master without exposing secrets, unless there are other concerns I'm not aware of, which I fully admit there might be.
          Hide
          jglick Jesse Glick added a comment -

          This would allow you to Stash world-readable files on the master without exposing secrets

          Basically $JENKINS_HOME should not be readable to other users.

          Show
          jglick Jesse Glick added a comment - This would allow you to Stash world-readable files on the master without exposing secrets Basically $JENKINS_HOME should not be readable to other users.
          Hide
          yrsurya suryatej yaramada added a comment -

          Hi,

              Is there any update on this feature , using copy to slave plugin for pipeline jobs if so please let us know

          Show
          yrsurya suryatej yaramada added a comment - Hi,     Is there any update on this feature , using copy to slave plugin for pipeline jobs if so please let us know
          Hide
          wangyoucao577 Jay Z added a comment -

          Also hope this copy to slave plugin can work for pipeline jobs. Seems that now we don't have any good function to copy big files from master to slave before build. 

          Show
          wangyoucao577 Jay Z added a comment - Also hope this copy to slave plugin can work for pipeline jobs. Seems that now we don't have any good function to copy big files from master to slave before build. 

            People

            • Assignee:
              svvivek Vivekanand SV
              Reporter:
              jglick Jesse Glick
            • Votes:
              7 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated: