Last active
November 21, 2020 13:49
-
-
Save jonesbusy/e3a6119ad86a569cdf769e107ef31805 to your computer and use it in GitHub Desktop.
Force the Rescan of all multibranch pipelines and organisation folders
This file contains hidden or 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 scannableItems = jenkins.model.Jenkins.instance.getAllItems(org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) + | |
jenkins.model.Jenkins.instance.getAllItems(jenkins.branch.OrganizationFolder) | |
scannableItems.collect { jenkins.model.Jenkins.getInstance().getQueue().schedule(it, 0, null, null)}.each { waitingItem -> | |
def future | |
def result | |
try { | |
future = waitingItem.getFuture() | |
result = future.get(timeout, TimeUnit.SECONDS) | |
println("${result} : ${result.getResult()}. Took ${result.getEstimatedDuration() / 1000.0} seconds") | |
} | |
catch (e) { | |
println("Unable to wait from item ${future} to finish") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment