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.)

          [JENKINS-28386] Workflow support for Copy to Slave plugin

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

          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.

          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.

          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.

          mcrooney added a comment - - edited

          Thanks jglick, 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"
          }
          

          mcrooney added a comment - - edited Thanks jglick , 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" }

          Jesse Glick added a comment -

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

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

          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.

          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.

          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.

          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.

          Hi,

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

          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

          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. 

          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. 

          Jan Bijota added a comment -

          Hi svvivek, is there any update about this issue?

          Thanks,

          Jan

          Jan Bijota added a comment - Hi svvivek , is there any update about this issue? Thanks, Jan

            svvivek Vivekanand SV
            jglick Jesse Glick
            Votes:
            8 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: