Disable Artifact Archiving With Jenkins DSL

2016-05-13 00:37UTC

Out of the box, the Jenkins DSL project doesn't currently provide a way of disabling artifact archiving. For projects with large outputs built on slave nodes, this can cause dramatic slowdowns as gigabytes of data are sent back to the master. Luckily, the configure block can be used to disable archiving, speeding those builds back up.

configure { project ->
    project / 'archivingDisabled'(true)
}

If so desired, this could be pulled into a Closure

class MavenHelper {
    static Closure disableArchiving(disabled) {
        return { project -> project / 'archivingDisabled'(disabled) }
    }
}

and then statically invoked within the mavenProject

configure MavenHelper.disableArchiving(true)

You can read more about the configure block on the official documentation.