Thanks Jesse, that helped. If I understood correctly, there's not necessarily one node's workspace for a given build of Pipeline. Is there any mechanism for a step (shell step in this case) to notify the master (or the following plugin step) on which Node did it run? That is so the following step (the plugin) will know from where to pick the input files created by the shell step?
Thanks, Tal. On Tuesday, October 29, 2019 at 3:58:43 PM UTC+2, Jesse Glick wrote: > > On Tue, Oct 29, 2019 at 8:47 AM Tal Yanai <[email protected] <javascript:>> > wrote: > > if(build.getWorkspace().isRemote()){ > > channel = (hudson.remoting.Channel) > build.getExecutor().getCurrentWorkspace().getChannel(); > > hudson.FilePath newFile = new hudson.FilePath(channel, > fileOnDiskPath); > > } > > No need to check `isRemote` nor to cast to `Channel` nor to call the > `FilePath` constructor manually. Just use > > FilePath newFile = build.getWorkspace().child(fileOnDiskPath); > > unconditionally. You would typically pass a relative pathname; see: > https://javadoc.jenkins.io/hudson/FilePath.html#child-java.lang.String- > > > This works OK when "build" is AbstractBuild, but it's a puzzle to me how > do I get it when 'build' is from type "hudson.model.Run". > > For a Pipeline build? There is no equivalent concept. A `FilePath > workspace` will be provided to you from various extension points, in > this case probably `SimpleBuildStep`: > > > https://jenkins.io/doc/developer/plugin-development/pipeline-integration/#basic-update > > -- You received this message because you are subscribed to the Google Groups "Jenkins Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/5b4b2c77-a6fe-4e52-ba64-9ec9d5a05c0b%40googlegroups.com.
