-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Blockade prow plugin (formerly block-paths munger). #4944
Conversation
3c0db6d
to
b840947
Compare
prow/plugins/blockade/blockade.go
Outdated
- kubernetes-incubator | ||
- kubernetes/kubernetes | ||
- kubernetes/test-infra | ||
blockregexps: |
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.
document the flow at the top: default allow, deny if a changed file matches any of blockregexps, but allow if it matches any of exception regexps. blocking means adding do-not-merge/blocked-paths
.
|
||
const ( | ||
pluginName = "blockade" | ||
blockedPathsLabel = "do-not-merge/blocked-paths" |
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.
Should this be part of the config? Bad docs changes had a special label before. Other users might want a different label to be applied.
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.
If we let each blockade specify its own label and a blockade is removed, we won't know about that blockade's label anymore and won't be able to remove it from PRs that already have it.
We could allow partial customization of the label by allowing blockades to specify a label suffix and prefix all labels with do-not-merge/blockade/
or something like that. Then the plugin can remove any labels with the prefix that no longer apply. That would result in long label names and additional label bloat though.
prow/plugins/blockade/blockade.go
Outdated
explanation string | ||
} | ||
|
||
func (bd *blockade) isBlocker(file string) bool { |
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.
Should be isBlocked
prow/plugins/blockade/blockade.go
Outdated
labelPresent := hasBlockedLabel(labels) | ||
blockades := compileApplicableBlockades(org, repo, c.log, config) | ||
if len(blockades) == 0 && !labelPresent { | ||
return nil |
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.
// if the label is missing, we assume that we removed any associated comments.
prow/plugins/blockade/blockade.go
Outdated
*/ | ||
|
||
/* | ||
Example config for this plugin: |
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 comment should be above the actual config definition so that you get it with go doc
.
Comments addressed. PTAL |
prow/plugins/plugins.go
Outdated
- kubernetes/kubernetes | ||
- kubernetes/test-infra | ||
blockregexps: | ||
- "docs/.*" |
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.
use ' to quote regexps to avoid interpreting \ escapes
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.
Is that valid yaml? Back ticks don't appear to be a valid replacement for quotes.
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.
not back ticks, single quotes
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.
Ah ok. Fixed.
Besides migrating this commit makes the behavior configurable by repo, org, or set of org and repos. Additionally it generates explanations of why each blocked PR was blocked.
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cjwagner, rmmh The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/cc @rmmh