From 79bf648619228d5d9ddbe3a5b08778962fc33d76 Mon Sep 17 00:00:00 2001 From: Nawaz Hussain Khazielakha Date: Thu, 16 Jan 2025 15:30:38 -0800 Subject: [PATCH] split verify gen into multiple targets This addresses swap file increase issue. --- .pre-commit-config.yaml | 138 ++++++++++++++++++++++------------------ Makefile | 9 ++- 2 files changed, 83 insertions(+), 64 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 71cd97e3c2e..0fbab040598 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,66 +1,78 @@ default_stages: [pre-commit, pre-push] default_install_hook_types: [pre-commit, pre-push] repos: -- repo: https://github.com/gitleaks/gitleaks - rev: v8.21.1 - hooks: - - id: gitleaks - stages: [pre-commit] -- repo: https://github.com/koalaman/shellcheck-precommit - rev: v0.10.0 - hooks: - - id: shellcheck - args: ["--external-sources"] - stages: [pre-commit] -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 - hooks: - - id: end-of-file-fixer - stages: [pre-commit] - - id: trailing-whitespace - stages: [pre-commit] - - id: detect-private-key - stages: [pre-commit] -- repo: https://github.com/pylint-dev/pylint - rev: v3.3.1 - hooks: - - id: pylint - exclude: ^hack/boilerplate/boilerplate.py$ - stages: [pre-commit] -- repo: https://github.com/jumanjihouse/pre-commit-hooks - rev: 3.0.0 - hooks: - - id: forbid-binary - stages: [pre-commit] -- repo: local - hooks: - - id: make-modules - name: Run make verify-modules - entry: make verify-modules - language: system - stages: [pre-push] - - id: make-gen - name: Run make verify-gen - entry: make verify-gen - language: system - stages: [pre-push] - - id: make-spellcheck - name: Run make verify-shellcheck - entry: make verify-shellcheck - language: system - stages: [pre-push] - - id: make-conversions - name: Run make verify-conversions - entry: make verify-conversions - language: system - stages: [pre-push] - - id: make-tiltfile - name: Run make verify-tiltfile - entry: make verify-tiltfile - language: system - stages: [pre-push] - - id: make-test - name: Run make go-test - entry: make go-test - language: system - stages: [pre-push] + - repo: https://github.com/gitleaks/gitleaks + rev: v8.21.1 + hooks: + - id: gitleaks + stages: [pre-commit] + - repo: https://github.com/koalaman/shellcheck-precommit + rev: v0.10.0 + hooks: + - id: shellcheck + args: ["--external-sources"] + stages: [pre-commit] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: end-of-file-fixer + stages: [pre-commit] + - id: trailing-whitespace + stages: [pre-commit] + - id: detect-private-key + stages: [pre-commit] + - repo: https://github.com/pylint-dev/pylint + rev: v3.3.1 + hooks: + - id: pylint + exclude: ^hack/boilerplate/boilerplate.py$ + stages: [pre-commit] + - repo: https://github.com/jumanjihouse/pre-commit-hooks + rev: 3.0.0 + hooks: + - id: forbid-binary + stages: [pre-commit] + - repo: local + hooks: + - id: make-modules + name: Run make verify-modules + entry: make verify-modules + stages: [pre-push] + language: system + require_serial: true + - id: make-gen + name: Run make generate + entry: make generate + stages: [pre-push] + language: system + require_serial: true + - id: make-verify-generate-local + name: Run make verify-generate-local + entry: make verify-generate-local + stages: [ pre-push ] + language: system + require_serial: true + - id: make-spellcheck + name: Run make verify-shellcheck + entry: make verify-shellcheck + stages: [pre-push] + language: system + require_serial: true + - id: make-conversions + name: Run make verify-conversions + entry: make verify-conversions + stages: [pre-push] + language: system + require_serial: true + - id: make-tiltfile + name: Run make verify-tiltfile + entry: make verify-tiltfile + stages: [pre-push] + language: system + require_serial: true + - id: make-test + name: Run make go-test + entry: make go-test + stages: [pre-push] + language: system + require_serial: true diff --git a/Makefile b/Makefile index 95c90887933..a35fa735033 100644 --- a/Makefile +++ b/Makefile @@ -287,6 +287,13 @@ verify-gen: generate ## Verify generated files are the latest. git diff; echo "generated files are out of date, run make generate"; exit 1; \ fi +.PHONY: verify-generate-local +verify-generate-local: ## Verify generated files are the latest. To be run locally + @if !(git diff --quiet HEAD); then \ + git diff; echo "generated files are out of date, run make generate"; exit 1; \ + fi + + .PHONY: verify-shellcheck verify-shellcheck: ## Verify shell files are shellcheck. ./hack/verify-shellcheck.sh @@ -379,7 +386,7 @@ create-workload-cluster: $(ENVSUBST) $(KUBECTL) ## Create a workload cluster. $(KUBECTL) get secret/$(CLUSTER_NAME)-kubeconfig -n default -o json | jq -r .data.value | base64 --decode > ./kubeconfig # TODO: Standardize timeouts across the Makefile and make them configurable based on the job. $(KUBECTL) -n default wait --for=condition=Ready --timeout=60m cluster "$(CLUSTER_NAME)" - + # Set the namespace to `default` b/c when the service account is auto mounted, the namespace is changed to `test-pods`. $(KUBECTL) --kubeconfig=./kubeconfig config set-context --current --namespace="default"