Re: new File is adding C: to the path of a linux container

2018-02-15 Thread red 888
This makes sense to me now. I'm trying to execute groovy code inside the 
slave (duh that obviously won't work). The groovy runtime is one the master 
so thats why its giving me back windows file paths- right?



On Thursday, February 15, 2018 at 12:33:23 PM UTC-5, ok999 wrote:
>
> Files generated by jenkins during a build is created in the master. You 
> have to use the "readFile" to use it in the compute environment of the 
> slaves/agents
>
> On Thu, Feb 15, 2018 at 10:57 AM, 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-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/2ee3d6c3-95b9-4f45-acf9-704228b0717b%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> Regards
> nirish okram
>

-- 
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/55e1d6b2-db9a-4d82-95c1-d8131fc3391f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: new File is adding C: to the path of a linux container

2018-02-15 Thread niristotle okram
Files generated by jenkins during a build is created in the master. You
have to use the "readFile" to use it in the compute environment of the
slaves/agents

On Thu, Feb 15, 2018 at 10:57 AM, 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/2ee3d6c3-95b9-4f45-acf9-704228b0717b%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Regards
nirish okram

-- 
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/CAPzcO4hGy_HK2Cr83ZQDDZQ0_HhnfdCHXrbAySA_r35Sd4vKWA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: new File is adding C: to the path of a linux container

2018-02-15 Thread 'Brownjay' via Jenkins Users
Also, depending on what your goals are in the future, you may want to use 
the findFiles 

 which 
is part of the pipeline utility steps plugin 
.

For example, I use the following to find a string in the log files of some 
test run and fail the pipeline if it finds it using findFiles:

def files = findFiles(glob: 'FEATURE_VALIDATION/smoketest/*.log');
for (def file : files) {
def logFile = readFile encoding: 'UTF-8', file: "${file.path}";
if (logFile.contains("FAIL***")) {
currentBuild.result = "FAILURE";
break;
}
}

}

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/2216bad8-fee4-4960-b1d2-86e3d6b45f8b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: new File is adding C: to the path of a linux container

2018-02-15 Thread 'Brownjay' via Jenkins Users
Hello,

I think the problem that you are experiencing can be explained here 
. 

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 
.

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.


new File is adding C: to the path of a linux container

2018-02-15 Thread red 888


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/2ee3d6c3-95b9-4f45-acf9-704228b0717b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.