Repository navigation
ci(codequality): offload differential code quality checks to Cloud Build - #1272
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a unified differential code quality check for Cloud Build CI, adding a new Cloud Build configuration, a 'codequality-ci' make target, and a 'run-codequality-ci.sh' script to prepare workspace artifacts and run checks. It also refactors the TypeScript mutation testing budget logic to support unlimited mutants (using 0) and adds the '--disable-dev-shm-usage' flag to ChromeHeadless configurations in Karma. Feedback suggests expanding the file matching pattern in 'run-codequality-ci.sh' from 'web/src/.ts' to 'web/' to ensure any frontend changes correctly trigger workspace preparation and prevent CI failures.
| case "${path}" in | ||
| web/src/app/generated/*|web/src/environments/*|*/zzz_*|*/zzz-*) | ||
| ;; | ||
| web/src/*.ts) |
There was a problem hiding this comment.
Currently, web/src/*.ts only matches TypeScript files. If a PR only modifies other frontend files under web/ (such as HTML templates *.html, stylesheets *.scss, or configuration files like package.json or karma.conf.js), has_ts will remain false. This causes the script to skip workspace preparation (npm ci and frontend asset generation), which leads to test failures or stale test runs in CI because the required dependencies or assets are missing.
Changing the pattern to web/* ensures that any non-ignored changes under the web/ directory correctly trigger the frontend workspace preparation.
| web/src/*.ts) | |
| web/*) |
Summary
Offloads differential Go and TypeScript code quality checks (
scripts/codequality) from GitHub Actions (ubuntu-latest) to Google Cloud Build (E2_HIGHCPU_32, 32 vCPUs) so PR verification stays fast while evaluating all reached mutants without budget truncation.Key Changes
.cloudbuild/github-codequality.yaml,scripts/run-codequality-ci.sh,scripts/make/testing.mk):make codequality-ciinsidegcr.io/kubernetes-history-inspector/builder:latestonE2_HIGHCPU_32with_MAX_MUTANTS=0(evaluate 100% of reached mutants) and_TIMEOUT=10m._BASE_BRANCH, supportingmain,epic/*, and stacked PR branches) in shallow clones and resolvesmerge-base.npm ciand Angular builds on pure Go backend changes outsidepkg/server/andcmd/, skips productionng buildon pure frontend TypeScript changes, and skips all codegen when neither Go nor TypeScript files changed.scripts/codequality/internal/tscheck):tscheck.Options.MaxMutantswithmutcheckandkarma_mutation_plugin.jsso--max-mutants=0evaluates all reached TypeScript mutants instead of falling back to80..github/workflows/pullrequest.yaml):go test ./...,make test-web) and linters (golangci-lint,codequality --conventions,lint-web) in GitHub Actions while removing differential coverage/mutation runs frompullrequest.yaml./dev/shmHardening (web/karma.conf.js,scripts/codequality/internal/tscheck/karma.go):--disable-dev-shm-usagetoChromeHeadlessNoSandboxso headless Chromium uses/tmpinstead of the 64 MB/dev/shmtmpfs inside Cloud Build step containers.Verification
go test ./scripts/...:PASSmake codequality-ci:PASS (0 violations)— Patch coverage100.0%(5/5), Mutation score100.0%(2/2killed)make pre-commit:PASS