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

fix: pre-commit-hooks and docs #475

Merged
merged 1 commit into from
Jan 24, 2023
Merged

Conversation

Kl0ven
Copy link
Contributor

@Kl0ven Kl0ven commented Jan 21, 2023

Hi
This PR implement this issue #222

  • Fix pre-commit-hooks to work with canonical pre-commit
  • Also update the documentation to reflect the changes

You can now add the hook by adding the following to your .pre-commit-config.yaml:

  - repo: https://github.com/stackrox/kube-linter
    rev: 0.6.0 # kube-linter version 
    hooks:
        # You can change this to kube-linter-system or kube-linter-docker
      - id: kube-linter

Fix pre-commit-hooks to work with canonical pre-commit
Also change the documentation to reflect the changes
@Kl0ven Kl0ven requested a review from janisz as a code owner January 21, 2023 15:25
@janisz janisz merged commit c340ea9 into stackrox:main Jan 24, 2023
@djhoese
Copy link

djhoese commented Jan 24, 2023

Have you gotten this to work on your own system? I've tried using the kube-linter version and I get errors like:

Error: unknown command "some_dir/some-pvc.yaml" for "kube-linter"
Error: unknown command "some_dir/some-configmap.yaml" for "kube-linter"
...

This seems to me like the hook is configured in a way that is passing multiple files to kube-linter lint at once and kube-linter is interpreting them as commands...maybe?

I thought maybe my pre-commit environment was pulling in the old version of the hook so I did pre-commit clean in hopes of clearing things a bit, but I still get the above errors. Any ideas?

@Kl0ven
Copy link
Contributor Author

Kl0ven commented Jan 24, 2023

Hi,
Sorry, my example was wrong. The 0.6.0 tag still has the old pre-commit hooks

 - repo: https://github.com/stackrox/kube-linter
    rev: 0.6.0 
    hooks:
      - id: kube-linter

Testing with the branch main is working (It's not recommended to use branch)

  - repo: https://github.com/stackrox/kube-linter
    rev: main
    hooks:
      - id: kube-linter

Should work on the next tag :)

@djhoese
Copy link

djhoese commented Jan 24, 2023

Ah perfect, thanks. I set it to the latest commit hash and that worked too (c340ea9b1c4ea1b36664f34ea4d4d0f92e4c285c).

abrad3 pushed a commit to abrad3/kube-linter that referenced this pull request Sep 28, 2023
Fix pre-commit-hooks to work with canonical pre-commit
Also change the documentation to reflect the changes
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.

3 participants