Hello,

I think the problem that you are experiencing can be explained here 
<https://stackoverflow.com/a/32514581/7764351>. 

Basically, you can't use new File to create files in the slaves workspace 
(using the new File call will only do file things on the master).  To do 
file interactions in the slaves workspace you'll have to use the FilePath 
<http://javadoc.jenkins-ci.org/hudson/FilePath.html>.

On Thursday, February 15, 2018 at 9:57:22 AM UTC-7, red 888 wrote:
>
> I have a windows master that executes a stage in a container on a linux 
> slave.
>
>
> Groovy is appending a "C:" to the path inside the linux container- totally 
> breaking it:
>
> stage('sdlfkjsldkf') {
>     agent {
>         docker {
>             image "library/alpine"
>         }
>     }
>
>     steps {
>         script {
>             new File("${workspace}/blah")
>                 .traverse(type: FileType.DIRECTORIES, nameFilter: 
> 'subfolder') {
>                 echo "${it.path}"
>             }
>         }
>
> The error I get:
>
> java.io.FileNotFoundException: 
> C:\home\jenkins\workspace\myworkspace\blah\subfolder
>
> if I echo ${workspace} it correctly starts at /home, but it looks like new 
> file want to add "C:" to the beginning of it
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/56163872-5a01-4cb5-921f-c330864a6041%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to