Last active
September 20, 2016 07:27
-
-
Save matthiasbaldi/a01e4ce52e46c93a769c819c1951fa84 to your computer and use it in GitHub Desktop.
Reload Jenkins Job
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
// inspired by https://github.com/jenkinsci/jenkins-scripts/blob/master/scriptler/reloadJobConfig.groovy | |
// by Matthias Baldi @2016 | |
import java.io.File; | |
import java.io.InputStream; | |
import java.io.FileInputStream | |
import javax.xml.transform.stream.StreamSource | |
// load job and configuration | |
def job = Jenkins.instance.getItemByFullName("PA-ISA-APIs-admin") | |
File file = job.getConfigFile().getFile() | |
// refresh job configuration | |
InputStream is = new FileInputStream(file); | |
job.updateByXml(new StreamSource(is)); | |
job.save(); | |
println("Configuration of Job " + job.name + " refreshed.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment