Last active
May 22, 2019 20:29
-
-
Save stephenmenton/2d52c9477cea62b4d0336a5bbff93bdc to your computer and use it in GitHub Desktop.
need to remove triggers from multibranch pipeline jobs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def job = Jenkins.instance.getItemByFullName('/path/to/multibranchPipeline') | |
job.triggers.forEach { k, v -> | |
println "k: ${k}" | |
println "v: ${v}" | |
if (k instanceof com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger$DescriptorImpl) { | |
println "match, removing" | |
job.triggers.remove(k) | |
} | |
} | |
job.save() | |
println "and then..." | |
job.triggers.forEach { k, v -> | |
println "k: ${k}" | |
println "v: ${v}" | |
} | |
// "But... the job refused to change." | |
// triggers is a readonly field in org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment