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: guarantee codegen targets are executed on pre-commit #1258

Conversation

floreks
Copy link
Member

@floreks floreks commented Aug 8, 2024

  • Updated README to describe how to enable git hooks for this repo
  • Added make install-git-hooks root target that updates local git core.hooksPath for this repo to point to the custom hooks dir
  • Added custom pre-commit script that checks for staged files path and if controller or client files were updated, it will run dedicated codegen targets.
$ git commit -m "initial commit"
Executing pre-commit hook
Client files changed
Running generate...
[Warning] Check for any unstaged files and commit them before push
Controller files changed
Running codegen...
/home/floreks/go/bin/controller-gen rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./..." output:crd:artifacts:config=config/crd/bases
/home/floreks/go/bin/controller-gen object:headerFile=/home/floreks/Projects/plural/console/go/controller/../../go/tools/boilerplate.go.txt paths="./..."
/home/floreks/go/bin/mockery
08 Aug 24 13:56 CEST INF Starting mockery dry-run=false version=v2.43.2
08 Aug 24 13:56 CEST INF Using config: /home/floreks/Projects/plural/console/go/controller/.mockery.yaml dry-run=false version=v2.43.2
08 Aug 24 13:56 CEST INF done parsing, loading dry-run=false version=v2.43.2
08 Aug 24 13:56 CEST INF done loading, visiting interface nodes dry-run=false version=v2.43.2
08 Aug 24 13:56 CEST INF generating mocks for interface dry-run=false interface=ConsoleClient qualified-name=github.com/pluralsh/console/go/controller/internal/client version=v2.43.2
08 Aug 24 13:56 CEST INF writing to file dry-run=false file=internal/test/mocks/ConsoleClient_mock.go interface=ConsoleClient qualified-name=github.com/pluralsh/console/go/controller/internal/client version=v2.43.2
/home/floreks/go/bin/crd-ref-docs --source-path=./api --renderer=markdown --output-path=./docs/api.md --config=config.yaml
2024-08-08T13:56:37.090+0200    INFO    crd-ref-docs    Loading configuration   {"path": "config.yaml"}
2024-08-08T13:56:37.091+0200    INFO    crd-ref-docs    Processing source directory     {"directory": "./api", "depth": 10}
2024-08-08T13:56:37.649+0200    INFO    crd-ref-docs    Rendering output        {"path": "./docs/api.md"}
2024-08-08T13:56:37.664+0200    INFO    crd-ref-docs    CRD reference documentation generated
2024-08-08T13:56:37.664+0200    INFO    crd-ref-docs    Execution time: 573.125899ms
[Warning] Check for any unstaged files and commit them before push

Test Plan

Locally

Checklist

  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a meaningful title and summary to convey the impact of this PR to a user.

@floreks floreks added the enhancement New feature or request label Aug 8, 2024
@floreks floreks self-assigned this Aug 8, 2024
Copy link

linear bot commented Aug 8, 2024

@floreks floreks merged commit b790534 into master Aug 9, 2024
13 checks passed
@floreks floreks deleted the sebastian/prod-2388-guarantee-make-chart-rbac-and-make-crd-docs-are-run-on branch August 9, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants