Created
February 20, 2024 04:32
-
-
Save kubosuke/c18ca90e61495b62bef5eba64730a522 to your computer and use it in GitHub Desktop.
for reloading config.xml after edit
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
import java.io.InputStream; | |
import java.io.FileInputStream | |
import java.io.File; | |
import javax.xml.transform.stream.StreamSource | |
def hudson = hudson.model.Hudson.instance; | |
Jenkins.instance.getAllItems(AbstractProject.class).each {job -> | |
if (job.fullName.startsWith("YourFolder/")) { | |
def configXMLFile = job.getConfigFile(); | |
def file = configXMLFile.getFile(); | |
InputStream is = new FileInputStream(file); | |
job.updateByXml(new StreamSource(is)); | |
job.save(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment