How can I access Jenkins build artifacts from the groovy Postbuild plugin?
continuous-integration, groovy, java, jenkins, maven
Solution
In case this is useful for anyone in the future, the solution that I went with was to find the artifact that I was looking for in `manager.build.getArtifacts()` and join that path with `manager.build.getArtifactsDir()`
Problem
Is there a way to read a build artifact file using the Groovy postbuild plugin? Some context: I have written some testng tests that are run by maven in Jenkins. Jenkins runs the tests, gives me the test results, etc. However, I have been asked to also store the results in HP's Application Lifeycycle Management (ALM). A coworker provided me with a post-build groovy script that can interface with ALM and store the test results. I have to pass these parameters to that script: - jobname - pass/fail status - test start time My idea was to store testng-results.xml as an artifact and parse out the results with xmlslurper, but I don't know how to read the artifact from the groovy plugin. From the groovy postbuild plugin page I have gathered that it might also be possible to read the test results directly from the manager.build variable, but I don't have a lot of experience with Jenkins or this plugin and so far I have been unsuccessful. I'm also open to other approaches as well. The groovy script is running on the Jenkins server, not on the slave node.