ob DSL and isDirectory does not work, any ideas?

14 views
Skip to first unread message

thomas....@teamaol.com

unread,
Mar 29, 2017, 7:34:41 AM3/29/17
to job-dsl-plugin
Hi,

I have (locally) Jenkins 2.49 and Job DSL 1.58 and Groovy version 2.4.8

I need a way to iterate files in a folder to load configuration (multiple files) from it.
Following code does not work using Job DSL:

 a) you need WORKSPACE to build absolute path
     The normal Groovy code new File("config").getAbsolutePath() does not work (with groovyConsole all fine)
 b) isDirectory prints out "false" also normal groovy code says "true". (with groovyConsole all fine)



println(GroovySystem.version)
def path = new File(WORKSPACE + "/config").getAbsolutePath()
println("info (path)        : " + path)
println("info (isDirectory) : " + new File(path).isDirectory())

Output:

+ mkdir -p config
Processing provided DSL script
2.4.8
info (path)        : /data/jenkins/local/workspace/TMP/config
info (isDirectory) : false


Any help is appreciated ...

kind Regards,
Thomas

thomas....@teamaol.com

unread,
Mar 29, 2017, 8:30:01 AM3/29/17
to job-dsl-plugin
I found this post:

However it does not solve my problem. I need - at least - a function that gives me the
list of files for a given folder so I can finall use readFileFromWorkspace on each entry.

Daniel Spilker

unread,
Mar 29, 2017, 12:04:45 PM3/29/17
to job-dsl...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/c38ef893-05b2-4ae3-bccb-0111794f9786%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

thomas....@teamaol.com

unread,
Mar 31, 2017, 8:32:38 AM3/31/17
to job-dsl-plugin
Thank you very much; it works fine for me!
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages