get secret text:
echo withCredentials([string(credentialsId: "<id>", variable: "s")]) { s }
get username and password:
println withCredentials([usernamePassword(credentialsId: "<id>", usernameVariable: "u", passwordVariable: "p")]) { [u, p] }
delete jobs in view:
Jenkins.instance.getView("<view>").items.each { item ->
println "delete: ${item.name} ..."
item.delete()
}
kill zombie job:
Jenkins.instance.getItemByFullName("<name>").getBuildByNumber(<number>).finish(hudson.model.Result.ABORTED,
new java.io.IOException("Aborting build"))
disable jobs:
Jenkins.instance.getItemByFullName("<name>").allJobs[0].disabled = <true|false>