Skip to content

Instantly share code, notes, and snippets.

Avatar

Steven Tobias stobias123

View GitHub Profile
View gist:d1759e0d61e58ea94e4994c98566ab4c
import groovyx.net.http.*
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.json.JsonBuilder
import groovy.json.StreamingJsonBuilder;
RESTClient myClient
@stobias123
stobias123 / findBuilds.groovy
Last active Apr 10, 2018
Jenkins set log rotators
View findBuilds.groovy
jenkins.model.Jenkins.instance.getAllItems().each {
if ( it.getClass() != com.cloudbees.hudson.plugins.folder.Folder && it.getClass() != org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject ){
try {
if (it.getLastBuild().number != null && it.getLastBuild().number > 10 ){
if(it.getLogRotator() == null){
println it.getFullName() + " Build number " + it.getLastBuild().number;
if(it.getClass() != org.jenkinsci.plugins.workflow.job.WorkflowJob){
println ' ---> Setting a log rotator that will delete any artifacts/builds older than number 200'
//job.logRotator = new hudson.tasks.LogRotator ( null, 200, 00, 200)
}
View keybase.md

Keybase proof

I hereby claim:

  • I am stobias123 on github.
  • I am stobias123 (https://keybase.io/stobias123) on keybase.
  • I have a public key ASDdHlDtkKTnTmBeRdszn03XQvZ13ZRylMIY1L3iae02nAo

To claim this, I am signing this object: