Skip to content
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

feat: add pre-commit hook support #1077

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thevilledev
Copy link
Contributor

@thevilledev thevilledev commented Feb 24, 2025

Add pre-commit integration to validate configurations against OPA policies:

  • Create .pre-commit-hooks.yaml with conftest test/verify hook configs
  • Add pre-commit hook tests using bats
  • Install pre-commit in CI workflow

Fixes #1011

@@ -73,6 +73,15 @@ jobs:
- name: unit test
run: make test

- name: setup python
Copy link
Member

Choose a reason for hiding this comment

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

Why does the conftest repo need to install this in the PR flow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not a requirement, but without it the workflow will use the Python version that's bundled with the CI runner to install pre-commit. The Python version might change and possibly cause issues in the pipeline. Not sure if there's already loose dependencies like this to the CI runner binaries/versions?

@thevilledev thevilledev force-pushed the feat/pre-commit branch 3 times, most recently from 82f5e16 to 40d784f Compare March 2, 2025 07:08
@thevilledev thevilledev changed the title feat: add pre-commit hook support and examples feat: add pre-commit hook support Mar 2, 2025
@thevilledev
Copy link
Contributor Author

thevilledev commented Mar 2, 2025

I'll add a separate "conftest-test" and "conftest-verify" hooks to cover both cases. Will mark this as a draft until done later today!

EDIT: done :)

@thevilledev thevilledev marked this pull request as draft March 2, 2025 07:29
Add pre-commit integration to validate configurations against OPA policies:
- Create .pre-commit-hooks.yaml with conftest test/verify hook configs
- Add pre-commit hook tests using bats
- Install pre-commit in CI workflow

Signed-off-by: Ville Vesilehto <[email protected]>
@thevilledev thevilledev marked this pull request as ready for review March 2, 2025 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add pre-commit support
2 participants