Skip to content

Instantly share code, notes, and snippets.

@nehaljwani
Created December 8, 2017 11:34
Show Gist options
  • Save nehaljwani/3f267cd72b471b221fa7061c36981368 to your computer and use it in GitHub Desktop.
Save nehaljwani/3f267cd72b471b221fa7061c36981368 to your computer and use it in GitHub Desktop.
Jenkins System Groovy: Add k8s node
import hudson.model.Label
toProvision = 5
podLabel = Label.get('el6')
cloud = Jenkins.instance.clouds.find { it.canProvision(podLabel) }
cloud.provision(podLabel, toProvision).collect().each {
node = it.future.get()
Jenkins.instance.addNode(node)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment