简体   繁体   中英

How to massively add post-build action in multiple Jenkins jobs

Subject is self-explanatory. I'd like to add post-build actions for many Jenkins jobs, instead of configuring one by one. I added Configuration Slicing plugin but if I'm not mistaken it doesn't modify post-build actions. Any ideas?

Thanks in advance

If Configuration Slicing Plugin doesn't satisfy your requirments, then you should fall back to SED.

From Jenkins Issues :

You will need to write a script that will loop through your Jenkins jobs and SED the value with a new one then use POST https://support.cloudbees.com/hc/en-us/articles/218353308-How-to-update-job-config-files-using-the-REST-API-and-cURL

  1. Get current config
    curl -X GET http://developer:developer@localhost:8080/job/test/config.xml -o mylocalconfig.xml

  2. Post updated config
    curl -X POST http://developer:developer@localhost:8080/job/test/config.xml --data-binary "@mymodifiedlocalconfig.xml"

For the Pos-build actions is the markups between <publishers>...</publishers> in the config.xml

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