简体   繁体   中英

Run jenkins post build step on the slave node instead of Master

I have created a Jenkins job and am able to assign it to run on the master/slave using their label name in Restrict where this project can be run . My job needs to do this

  1. Copy test data to a target folder (not Jenkins workspace)
  2. Run the test
  3. Summarize results
  4. Cleanup the folder with data - Yet to be implemented

Regarding step4, I have to delete the data before marking the job as complete. I have considered a Conditional Build step and it looks to be working in all cases except when the job is aborted.

I am considering a Post Build step using PostBuildTask /GroovyPostBuild and it only works when the job is assigned to run on Master . The issue here is when I try to run the job on Slave1/Slave2, the same task doesn't seem to work and I realized that its being executed on Master instead of Slave1/2.

Would appreciate any guidance on how I can solve this issue.

Thanks

Yes, Post build steps run on Master by default. So, you need another plugin allow you to choose which node you want to run Post build step. In my system, I use "Flexible Publish" plugin that I see it can solve you issue

Flexible plugin example

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