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
#Bring back a Jenkins node thread from the ashes | |
# to use: export JENKINS_USERNAME="" and export JENKINS_PASSWORD="" | |
# Enjoy! | |
JENKINS_URL="http://localhost:8080"; | |
NODE_PREFIX="ND-"; | |
for ((node=1;node<=10;node++)); | |
do | |
NODE_NAME=`printf "%s%02d" $NODE_PREFIX $node` |
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
def jenkins = hudson.model.Hudson.instance | |
def template = jenkins.getItem("MyTemplate") | |
def job = jenkins.copy(template,"MyNewJob") | |
job.scm = new hudson.scm.SubversionSCM("http://base/branches/mybranche") | |
job.save() |
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
cd /var/lib/jenkins/jobs; | |
for i in `find . -name "config.xml" | grep -v backup_config | xargs grep -i "hudson.plugins.templateproject.ProxyBuilder" | cut -d ":" -f 1`; do echo $i; job=`echo $i|cut -d "/" -f 2`; echo "job=$job"; cat $i | grep -i projectname | grep $job;done |
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
Jenkins.instance.getItemByFullName('<job-name>').each { | |
try { | |
println(it.logRotator.perform(it)) | |
} catch (Exception e) { | |
println("It didn't work: "+ e) | |
} | |
} |
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
def config = new HashMap() | |
def bindings = getBinding() | |
config.putAll(bindings.getVariables()) | |
def out = config['out'] | |
new ClassA().testMe(out); | |
class ClassA { | |
void testMe(out) { | |
out.println('testMe'); | |
} |
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
def jlc = new jenkins.model.JenkinsLocationConfiguration(); | |
println jlc.getUrl() | |
println jlc.getAdminAddress() |
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
this.getClass().classLoader.rootLoader.addURL(new File("file.jar").toURL()) |
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 hudson.model.* | |
import hudson.model.labels.* | |
import hudson.maven.* | |
import hudson.tasks.* | |
import hudson.plugins.git.* | |
hudsonInstance = hudson.model.Hudson.instance | |
allItems = hudsonInstance.allItems | |
buildableItems = allItems.findAll{ job -> job instanceof BuildableItemWithBuildWrappers } |
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
#!/usr/bin/env groovy | |
/* | |
Fairly self explanatory if you look at the options in the UI. | |
Main thing to note is the JENKINS_MESOS_SLAVE_<number>. Anything with the same | |
number will be associated together option wise. | |
For things like JENKINS_MESOS_SLAVE_<number>_VOL_<number> The trailing | |
number just signifies more than one. | |
--Available Environment Variables -- |
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
Jenkins.instance.items.findAll {job-> | |
job.name.startsWith('<prefix-of-the-jobs>')//add the starting string - name of the job | |
}.each { | |
item -> | |
if (item.disabled == false) { | |
println item.name | |
item.disabled=true | |
item.save() | |
} |
OlderNewer