Skip to content

Instantly share code, notes, and snippets.

@ivan-pinatti
Last active October 31, 2019 20:27
Show Gist options
  • Save ivan-pinatti/c048392e8df92eb3e9bf95db14cd5f59 to your computer and use it in GitHub Desktop.
Save ivan-pinatti/c048392e8df92eb3e9bf95db14cd5f59 to your computer and use it in GitHub Desktop.
Jenkins - Set number of executors via groovy script - #jenkins #groovy
#!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()
@Stqs
Copy link

Stqs commented Aug 1, 2018

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment