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

ci: added pre-commit #811

Merged
merged 9 commits into from
Dec 16, 2024
Merged

ci: added pre-commit #811

merged 9 commits into from
Dec 16, 2024

Conversation

lukasmetzner
Copy link
Contributor

@lukasmetzner lukasmetzner commented Dec 16, 2024

This PR introduces a pre-commit config which is used in our ci pipeline. Furthermore, an additional formatting of all affected resources was done.

The following config was used as a baseline: https://github.com/hetznercloud/.github/blob/main/.pre-commit-config.yaml

@lukasmetzner lukasmetzner requested a review from a team as a code owner December 16, 2024 08:00
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.34%. Comparing base (9e9d983) to head (4f003f2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #811   +/-   ##
=======================================
  Coverage   35.34%   35.34%           
=======================================
  Files          20       20           
  Lines        1901     1901           
=======================================
  Hits          672      672           
  Misses       1195     1195           
  Partials       34       34           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
.goreleaser.yml Outdated Show resolved Hide resolved
hooks:
- id: prettier
files: \.(md|ya?ml|json)$
exclude: ^(CHANGELOG.md|chart/templates/.*|chart/.snapshots/.*)$
Copy link
Member

Choose a reason for hiding this comment

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

I'd rather keep the snapshots in there, if pre-commit fails on the snapshots, the templates might need a fix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Running prettier and helm template causes some conflicts. pre-commit (prettier) wants to format the yaml. In the CI we check for a diff after running helm template, which always fails as the formatting is different.

Should we write a custom pre-commit hook to address this?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, this what I had in mind with #811 (comment)

.pre-commit-config.yaml Outdated Show resolved Hide resolved
@jooola
Copy link
Member

jooola commented Dec 16, 2024

There are a bunch of script in https://github.com/hetznercloud/csi-driver/tree/main/hack that could be run as part of pre-commit :)

This could also remove a few CI jobs running those scripts.

lukasmetzner and others added 5 commits December 16, 2024 09:53
Co-authored-by: Jonas L. <[email protected]>
Co-authored-by: Jonas L. <[email protected]>
Co-authored-by: Jonas L. <[email protected]>
We added the pre-commit configuration file and simplified our CI scripts.
Copy link
Member

@jooola jooola left a comment

Choose a reason for hiding this comment

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

The snapshots are ignored by prettier because it is a pain to fix the helm templates, this task can be picked up by anyone having the energy to do it.

🧹

@lukasmetzner lukasmetzner merged commit ffaf6ba into main Dec 16, 2024
6 checks passed
@lukasmetzner lukasmetzner deleted the add-pre-commit branch December 16, 2024 13:15
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.

2 participants