Enforce pre-commit to be running in github actions#9459
Enforce pre-commit to be running in github actions#9459mtrqq wants to merge 9 commits intokubernetes:masterfrom
Conversation
|
Skipping CI for Draft Pull Request. |
Currently we have pre-commit configuration which is not enforced which prevents from using it whatsoever, this PR brings it into github actions to verify whether PR/commit passes the validation. Along the way it adds 3 more hooks to the list: go files formatting (go-fmt), avoiding mixed line endings and enforce single format (mixed-line-ending), check for large files added into repo like binaries (check-added-large-files). All the hooks seem to be easy to follow and non-controvertial between different autoscaling subprojects.
|
I'm not a fan of this, I think we should get rid of pre-commit in this repo. There is a lot of generated or vendored content in this repo, which I don't believe pre-commit should be touching. |
I completely agree with your take, generated content shouldn't be managed/verified by pre-commit and this is easily controlled by excluded files/folders in the configuration file, I've added couple initial entries referring to vendor folders in the repository I know about and API docs of vertical pod autoscaler which conflicts due to As for the Considering all above I think pre-commit may still be useful for development flow, I personally found myself messing up the formatting of the golang file right before the commit so that it causes verification CI build to fail - this change essentially enforces automatic tool which does that for you. |
|
TBH,I agree with Adrian here. I think we should get rid of pre-commit entirely in this repo.
IMO, we should stick with how k/k do things - each sub-repo should have a |
To be clear, Omer and I only really speak for the VPA section. If the other projects in this repo want pre-commit, they're welcome to have it |
Contributors may not install pre-commit and it'll also work just fine as long as the validation passes so the contributor flow doesn't alter significantly, while improving developer productivity for those who decide to opt-in into installing hooks locally. Validation requirements on the CI are quite minimal and in my opinion non controversial, but I am absolutely open to dropping specific checks if some of them feel excessive.
As for the large number of changes in this PR, I ran all the hooks across the repo intentionally. The goal was to consolidate all baseline formatting updates into a single PR so we don't pollute future feature PRs with unrelated formatting noise. Alternatively we may incrementally do them once the file is getting changed for one or another reason, but to my mind it's more intrusive option in the long term |
I think the entire |
|
@adrianmoisey I've excluded VPA from the pre-commit configuration, it won't be checked in CI and hooks will ignore the folder completely, do you want me to revert all the changes done to VPA folder in this PR like line endings and new lines at the end of the file? |
|
@elmiko @jackfrancis Can you review this PR from cluster autoscaler perspective as you've recently reviewed the PR connected to pre-commit configuration? Ref: #9129 |
Yup, please do, those don't bother us. |
…red installation process of a tool
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mtrqq The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
@mtrqq: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
This PR configures a github action to periodically run pre-commit on branch push and PR to validate hook states, minimal set of hooks is selected to avoid slowing down development flow. Biggest sources of generated files are explicitly excluded from the config, but not all of them - other entries should be populated as we go
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: