Created
April 27, 2013 03:24
-
-
Save jcsalterego/5471769 to your computer and use it in GitHub Desktop.
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
for (anItem in hudson.model.Hudson.instance.getQueue().getItems()) { | |
anItem.doCancelQueue() | |
} |
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
target = "job-name" | |
for (item in hudson.model.Hudson.instance.getQueue().getItems()) { | |
if (item.task.getName().equals(target)) { | |
println item.doCancelQueue() | |
} | |
} |
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
ignoreParams = new HashSet<String>() | |
ignoreParams.add("from_date") | |
ignoreParams.add("to_date") | |
seen = new HashSet<Map<String,String>>() | |
items = hudson.model.Hudson.instance.getQueue().getItems() | |
for (i = items.length - 1; i >= 0; i--) { | |
item = items[i] | |
params = item.getActions() | |
for (param in params) { | |
if (param instanceof ParametersAction) { | |
itemMap = new HashMap<String,String>() | |
for (p in param.getParameters()) { | |
name = p.getName() | |
if (!ignoreParams.contains(name)) { | |
itemMap.put(name,p.toString()) | |
} | |
} | |
if (seen.contains(itemMap)) { | |
print "DUPE: " | |
println param.getParameters() | |
println "" | |
item.doCancelQueue() | |
} else { | |
seen.add(itemMap) | |
} | |
} | |
} | |
} | |
println seen.size() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment