Skip to content

Instantly share code, notes, and snippets.

View refactorsaurusrex's full-sized avatar

refactorsaurusrex

View GitHub Profile
MAX_BUILDS = 5
MAX_ENV_BUILDS = 2
Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.job.WorkflowJob.class).each { it ->
def job = Jenkins.instance.getItemByFullName(it.fullName, Job.class)
def limit = (it.fullName =~ /^environment/) ? MAX_ENV_BUILDS : MAX_BUILDS
def recent = job.getBuilds().limit(limit)
println "Processing job " + it.fullName + " " + it.class + " BuildCount: " + job.getBuilds().size() + " Limit: " + limit
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active May 23, 2024 13:00
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@t3knoid
t3knoid / JenkinsTailJobConsole.groovy
Created February 12, 2018 18:28
Progressively read a Jenkins job console output using Groovy
def jenkinsBase = // Set to Jenkins base URL
def jenkinsJob = // Set to Jenkins job name
def address = null
def response = null
def start = 0 // Start at offset 0
def cont = true // This semaphore holds the value of X-More-Data header value
try {
while (cont == true) { // Loop while X-More-Data value is equal to true
address = "${jenkinsBase}/job/${jenkinsJob}/lastBuild/logText/progressiveText?start=${start}"
println("${address}")