I'm having some issues reading files from the local workspace. As part of my build a set of artifact files are created and I'd like to iterate over them, parse their json contents, and act on it in a pipeline step. However, I can't seem to get reading files from the workspace to work.
My stage looks like: stage('Push docker containers') { def slurper = new JsonSlurper() def files = new File(env.WORKSPACE).listFiles() for (int i = 0; i < files.size(); i++) { def file = files[i] println(file.name) if (file.name.endsWith(".json")) { def json = slurper.parse(file) json.each { key, value -> // do stuff } } } } I keep getting a null pointer on files.size. I've tried to ls the workspace to see whats in it, but nothing shows up. Whats the recommended approach here? Thanks -Anton -- 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/fd65242f-f3a7-4ba3-8717-3146639d759a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.