Skip to content

Conversation

@meomnzak
Copy link
Contributor

Description

Pre-commit hooks are now automatically installed when running make build or make test. This ensures all contributors run linting checks before commits without manual setup.

Also removes the go test ./... hook from pre-commit config since running the full test suite on every commit is too slow.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Helm chart change
  • Other (please describe)

Testing

  • Unit tests added/updated
  • Helm chart tests pass (helm lint and template validation)
  • Tested changes manually
  • Added examples for new features

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have updated the relevant CRDs if needed
  • I have updated the Helm chart version if needed
  • I have added tests that prove my fix is effective or that my feature works

Additional context

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 24, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: meomnzak
Once this PR has been reviewed and has the lgtm label, please assign pfeifferj for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@meomnzak meomnzak marked this pull request as ready for review December 24, 2025 19:10
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Dec 24, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.77%. Comparing base (1a630bd) to head (898eaf0).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #468   +/-   ##
=======================================
  Coverage   55.77%   55.77%           
=======================================
  Files          58       58           
  Lines        8757     8757           
=======================================
  Hits         4884     4884           
  Misses       3525     3525           
  Partials      348      348           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@pfeifferj pfeifferj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally, you raise some good points. I have some questions/concerns regarding the implementation


## Development

### Git Hooks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding this now is fine, but generally I'd like to keep the readme as lean as possible.

cleaning up the readme/moving various bits of info to ./docs would be a nice followup ticket to create but I think it would be something I need to work on.

Comment on lines -19 to -23
- id: go-test
name: go test
entry: go test ./...
language: system
pass_filenames: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that the long runtime of tests is annoying but I don't want us to remove this entirely.

would moving them to a pre-push hook be a sensible compromise?


.PHONY: build
build: generate ## Build binary for current platform
build: ensure-hooks generate ## Build binary for current platform
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is an intuitive way to install the hooks and neither is the test target.

the ci target might make more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally fair point that this is not the most Intuitive place, but this is actually the reason behind this pr haha.
I always forgot make lint, and I saw other contributors miss that too. And I was like, why not make a pre-commit, but I actually found we have one. So the point was to document that we have it somewhere. And to make the developers install it in a "sneaky" way, since we always make build and make test.
I’m open to adjusting where the auto-install happens if there’s a better onboarding target, as long as we keep the hooks easy to discover and hard to miss.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's a point in being "sneaky" about it when the people who would benefit from it would probably also never think of running any of the make commands. but that's just my $0.02

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense, appreciate you sharing your perspective

Comment on lines +165 to +168
install-git-hooks: ## Install git hooks (pre-commit + gitlint)
pre-commit install
gitlint install-hook
@echo "Git hooks installed successfully."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this redundant if we have the ensure-hooks target?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants