-
Notifications
You must be signed in to change notification settings - Fork 415
Make purge-build-queue-by-name.groovy more flexible #162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,11 @@ | ||||||
| //Purge build queue by name | ||||||
|
|
||||||
| // find tasks by name which contains string pattern REPLACEME | ||||||
| import hudson.model.* | ||||||
| def q = Jenkins.instance.queue | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| q.items.findAll { it.task.name.startsWith('REPLACEME') }.each { q.cancel(it.task) } | ||||||
| q.items.findAll { it.task.name.contains('REPLACEME') }.each { println it.task.name } | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Since this does not have to reuse the |
||||||
|
|
||||||
| // purge | ||||||
| import hudson.model.* | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
as above |
||||||
| def q = Jenkins.instance.queue | ||||||
| q.items.findAll { it.task.name.contains('REPLACEME') }.each { q.cancel(it.task) } | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is implicit so no need to explicitly import. Also
Jenkinsclass is in thejenkins.modelpackage, not inhudson.modelso pointless anyway.