Last active
October 31, 2019 20:27
-
-
Save ivan-pinatti/c048392e8df92eb3e9bf95db14cd5f59 to your computer and use it in GitHub Desktop.
Jenkins - Set number of executors via groovy script - #jenkins #groovy
This file contains 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
#!groovy | |
// imports | |
import jenkins.model.Jenkins | |
// parameter | |
Integer numberOfExecutors = 2 | |
// get Jenkins instance | |
Jenkins jenkins = Jenkins.getInstance() | |
// set the number of slaves | |
jenkins.setNumExecutors(numberOfExecutors) | |
// save current Jenkins state to disk | |
jenkins.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks