-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add update-rules command to update publishing-bot rules #253
Conversation
4ea2dc7
to
a4b35dc
Compare
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.
@navidshaikh thanks for working on this, left some suggestions :)
cmd/update-rules/main.go
Outdated
glog.Fatalf("update failed, found invalid rules after update: %v", err) | ||
} | ||
|
||
data, err := yaml.Marshal(rules) |
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 removes comments...maybe consider using go-yaml/yaml to preserve comments (go-yaml/yaml#132)
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.
The comments are removed while the yaml content are deserialized into native ds. So at this point we don't have comments at all. To preserve comments, we'd need to load them into yaml.Node{}
and navigate using it (we may also need to update the way rules loading and validations done in cmd/publishing-bot/config/rules.go
). It's available in yaml.v3, currently we are using yaml.v2 here.
Updated PR to print the updated rules on stdout if no |
/cc |
/retitle Add update-rules command to update publishing-bot rules |
fb5474f
to
2f47d35
Compare
Rebased and squashed the commits. |
2f47d35
to
074abe7
Compare
I had tried to generate the rules in kubernetes/kubernetes#103844 using the code here. Some general observations:
|
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs. This bot triages issues and PRs according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
@navidshaikh @nikhita @palnabarun Is there any update on this PR? It would be nice to try to get this done -- it's definitely a very useful tool. /remove-lifecycle stale |
cc27ebf
to
f06bd2b
Compare
@xmudrii sorry for late reply! will work through the feedback now. @palnabarun : thanks for the review!
This tool uses the existing utils (using yaml.v2) to load the rules. To retain the comments I think we'll need yaml.v3. Question: Should we have alternate yaml loading utils (with yaml.v3) and use it with this tool to retain the comments?
👍 |
`make build` builds the CLI binary `make build-image` includes the CLI binary in the image Signed-off-by: Navid Shaikh <[email protected]>
Signed-off-by: Navid Shaikh <[email protected]>
Signed-off-by: Navid Shaikh <[email protected]>
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.
Parsing YAML comments is still non-trivial and I feel specifically for this feature, the benefits do not outweigh the effort needed. Looking back at the usage of comments in the latest
The above blob of comments can be in a GH issue instead of residing in a comment. With that, we may not need to parse comments at all and comment parsing becomes a non-blocker. Thanks @navidshaikh for working on this! ❤️ /lgtm |
/hold for other reviews |
👍 cc: @BenTheElder WDYT? |
@kubernetes/publishing-bot-maintainers -- Where did we land with this one? |
/hold cancel @palnabarun @justaugustus what are the follow ups after this merges? |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dims, justaugustus, navidshaikh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description:
cmd/update-rules
to update publishing-bot rules--rules
,--branch
-o
otherwise on prints stdout--go
flag else leave the field empty (omitempty
)Usage:
Examples:
fixes #252
TODO: