samrocketman / jenkins-bootstrap-jervis

An automated Jenkins CI environment which provisions agent infrastructure on the fly per build.
Apache License 2.0
75 stars 30 forks source link

Configure collapsing console plugin #8

Closed samrocketman closed 6 years ago

samrocketman commented 8 years ago

https://wiki.jenkins-ci.org/display/JENKINS/Collapsing+Console+Sections+Plugin

import org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionNote
import org.jvnet.hudson.plugins.collapsingconsolesections.CollapsingSectionsConfiguration

def j=Jenkins.instance
def c=j.getExtensionList(CollapsingSectionNote.DescriptorImpl)[0]

if(c.getSections().size() < 1) {
    CollapsingSectionNote section = new CollapsingSectionNote('{1}', '^\\# ([^ ]+ [^ ]+)$', '^\\$ set \\+x$', false)
    c.setSections([section] as CollapsingSectionNote[])
    c.numberingEnabled = false
    c.configuration = new CollapsingSectionsConfiguration(c.sections, c.numberingEnabled)
    c.save()
    println "Updated config."
}
samrocketman commented 6 years ago

No longer relevant since moving away from freestyle jobs. Migrating to 100% pipeline jobs is nearly complete.