Skip to content

Instantly share code, notes, and snippets.

View matthiasbaldi's full-sized avatar

Matthias Baldi matthiasbaldi

View GitHub Profile
// this script can be used to change the JDK for multiple Jenkins Jobs
// to use the script, edit the variables and run it in the Jenkins Script Console
// please set the variable value
def jobNameWithCorrectJdk = "" // set a JobName with the correct JDK
def jdkToChange = "JDK[JDK 1.8]" // set the JDK you want to change
def partOfJobNameToSearch = "" // set a part of the job name to generate the list of jobs
// script - here you have nothing to edit
def newJdk = Jenkins.instance.getItemByFullName(jobNameWithCorrectJdk).JDK