Created
November 13, 2020 21:43
-
-
Save shollingsworth/034832d3bed19b8cc87a5ae1ecfc12db to your computer and use it in GitHub Desktop.
change the ami id of jenkins ec2-plugin through groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import hudson.plugins.ec2.SlaveTemplate | |
| import jenkins.model.Jenkins | |
| Jenkins jenkins = Jenkins.getInstance() | |
| for (i in jenkins.clouds) { | |
| if (i.searchName == 'ec2-agent') { | |
| println i.templates[0].ami | |
| // i.templates[0].ami = 'ami-xxxxxxx' | |
| } | |
| } | |
| jenkins.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment