Forked from ivan-pinatti/jenkins-set-number-of-executors.groovy
Created
October 31, 2019 20:27
-
-
Save djom202/c74cd7b2473c01ac24b9eb4ea63c9404 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