简体   繁体   中英

How can I access Jenkins build artifacts from the groovy Postbuild plugin?

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.

万一这对将来的任何人有用,我所采用的解决方案是在manager.build.getArtifacts()查找所需的工件,并将该路径与manager.build.getArtifactsDir()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM