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

          Jesse Glick created issue -

          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.
          Patrick Wolf made changes -
          Epic Link New: JENKINS-34657 [ 170293 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 163224 ] New: JNJira + In-Review [ 181141 ]
          Andrew Bayer made changes -
          Labels Original: workflow New: pipeline workflow
          Andrew Bayer made changes -
          Labels Original: pipeline workflow New: pipeline

          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.

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

              Created:
              Updated: