It took me a while to figure this one out, the docs online were pretty thin, so I'm putting this here to help the next person who gets stuck.
There are 2 tricks here.
- It's not clear how to get the workspace in GroovyAxis. It has to be accessed through the 'context' object, but is null when the script is run when the job is saved. It is populated when the job is built.
- The workspace exists on the slave node, but the Groovy script is run on the master. You must use the FilePath object to correctly access the files on the slave