Last active
March 5, 2018 14:10
-
-
Save ilosamart/bf3226c567e0e27e92e40820eeb5a3a3 to your computer and use it in GitHub Desktop.
jenkins.groovy
This file contains hidden or 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.scm.* | |
import org.jenkinsci.plugins.envinject.EnvInjectJobProperty | |
def Job model = hudson.model.Hudson.instance.getItem("SONAR_TEMPLATE") | |
def EnvInjectJobProperty pModel = model.getProperty(EnvInjectJobProperty.class) | |
println(hudson.model.Hudson.instance.items.size) | |
for (item in hudson.model.Hudson.instance.items) { | |
/* | |
if (job.name.startsWith("SONAR_") && !job.name.contains("TEMPLATE")) { | |
def EnvInjectJobProperty p = job.getProperty(EnvInjectJobProperty.class) | |
println("FAZENDO: ["+job.name+"]") | |
job.removeProperty(p) | |
job.addProperty(pModel) | |
println("FEITO: ["+job.name+"]") | |
} | |
*/ | |
if (item instanceof Job) { | |
print(item.name) | |
if (item instanceof ExternalJob) { | |
println(";\tExternal job") | |
} | |
else if (item.scm instanceof SubversionSCM) { | |
println(";\t"+item.scm.locations) | |
} | |
} | |
} |
This file contains hidden or 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.scm.* | |
import org.jenkinsci.plugins.envinject.EnvInjectJobProperty | |
println(hudson.model.Hudson.instance.items.size) | |
for (item in hudson.model.Hudson.instance.items) { | |
if (item instanceof Job) { | |
println(item.name) | |
if (item.scm instanceof hudson.plugins.git.GitSCM) { | |
println (item.scm.userRemoteConfigs) | |
} | |
else { | |
println ('Not a git job') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment