Skip to content

Instantly share code, notes, and snippets.

View sasjo's full-sized avatar

Samuel Sjöberg sasjo

View GitHub Profile
@sasjo
sasjo / NexusArtifactCleanup.groovy
Created July 25, 2018 09:18 — forked from oliverdaff/NexusArtifactCleanup.groovy
Clean up nexus artifacts with API
@GrabResolver(name='mirror', root='http://repository/nexus/content/groups/public')
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7.1')
import groovyx.net.http.*
import static groovyx.net.http.ContentType.*
import static groovyx.net.http.Method.*
import org.apache.http.impl.conn.PoolingClientConnectionManager
import org.apache.http.params.HttpParams
import org.apache.http.client.HttpClient
import org.apache.http.impl.client.DefaultHttpClient
@sasjo
sasjo / drain_jenkins.groovy
Last active October 31, 2024 08:21
Drain Jenkins build queue and stop all running jobs
Jenkins.instance.queue.items.findAll { !it.task.name.contains("Extenda") }.each {
println "Cancel ${it.task.name}"
Jenkins.instance.queue.cancel(it.task)
}
Jenkins.instance.items.each {
stopJobs(it)
}
def stopJobs(job) {
if (job in jenkins.branch.OrganizationFolder) {
// Git behaves well so no need to traverse it.

Keybase proof

I hereby claim:

  • I am sasjo on github.
  • I am sasjo (https://keybase.io/sasjo) on keybase.
  • I have a public key ASC04ELMGKRky7ms-MBEKa3T8NStMhLjZa8VrWJpSjQIvwo

To claim this, I am signing this object: