Skip to content

ci: add CI gates for codegen drift, Go build, and Go unit tests #2499

Description

Problem

PR CI currently runs Helm/BATS unit tests, builds Docker images, and runs E2E tests, but does not validate three Go-related concerns. PR #2466 illustrated all three:

  1. Codegen drift: the PR modified api/apps/v1alpha1/postgresql/types.go (replacing a typed sub-struct with map[string]string) but make generate was not run. The orphan PostgreSQLParameters DeepCopyInto/DeepCopy methods left in zz_generated.deepcopy.go broke the package with three undefined: PostgreSQLParameters errors. CI did not flag this — code review did.
  2. Go build: make build (in pull-requests.yaml Build job) only builds Docker images and cmd/cozypkg. There is no go build ./... for the root module or for the other modules in the repo (api/apps/v1alpha1/, packages/apps/kubernetes/images/kubevirt-csi-driver/, packages/system/dashboard/images/token-proxy/, packages/system/kubeovn-webhook/images/kubeovn-webhook/). A broken submodule only fails compilation when something else imports it.
  3. Go unit tests: make unit-tests only runs helm-unit-tests.sh and bats-unit-tests. There is no go test ./... for any module.

The pre-commit config (.pre-commit-config.yaml) does declare a run-make-generate hook, but the workflow (.github/workflows/pre-commit.yml) only feeds *.yaml and *.md files into pre-commit run --files, so the generate hook never executes in CI.

Proposal

Add a new workflow (e.g. go-checks.yml), triggered on pull_request, with three jobs:

  1. Codegen drift gate:
    make generate
    git diff --exit-code
    Fails if make generate produces any change.
  2. Go build gate — go build ./... for the root module and each submodule listed above (or via go work if a workspace is appropriate).
  3. Go unit tests gate — go test ./... for each module above.

The job should run independently of the heavy E2E pipeline so contributors get fast feedback on code-level regressions that today only surface in review or once the cluster install fails.

Out of scope

  • Helm chart linting / values.schema.json drift (separate hardening; existing pre-commit workflow already lints YAML & Markdown).
  • Coverage reporting.

References

Activity

  1. added
    kind/featureCategorizes issue or PR as related to a new feature
    area/ciIssues or PRs related to CI workflows, GitHub Actions, automation
    area/testingIssues or PRs related to testing (e2e, bats, unit tests)
    triage/acceptedIndicates an issue is ready to be actively worked on
    priority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to complete
    on Apr 27, 2026
  2. myasnikovdaniil commented on Jul 8, 2026

    @myasnikovdaniil
    Contributor

    Correction — 2 of 3 gates already landed (2026-07-08)

    The body is stale — the "one go-checks.yml" never happened, but two of the three gates landed piecemeal:

    1. Codegen drift ✅ — .github/workflows/codegen-drift.yml (ci(api): add codegen drift check #2463) runs make generate and fails on any git status --porcelain diff (path-filtered to api/**, pkg/apis/**, Makefile, go.mod). Catches the feat(postgres)!: support all PostgreSQL configuration parameters #2466-class regression.
    2. Go unit tests ⚠️ partial — pull-requests.yaml runs make unit-tests (go test ./pkg/registry/... ./pkg/config/... ./pkg/cmd/server/...) + make test-controllers (go test ./internal/...). Not full ./... — ./cmd/... and nested image modules are uncovered.
    3. Go build ❌ — still no explicit fast go build ./... per-module gate; only codeql.yml autobuild covers it incidentally (slow, not a fast gate).

    So the remaining work is just gate 3 (explicit go build ./... across root + api/apps/v1alpha1/ + the image modules) and a decision on whether to widen gate 2 toward ./....

  3. lexfrei commented on Oct 2, 2026

    @lexfrei
    ContributorAuthor

    Correction: this comment was wrong, and there is no gap here. make unit-tests runs go-module-tests, which walks every go.mod in the tree and runs go test ./... in each, and pull-requests.yaml runs make unit-tests on every PR. That covers packages/apps/kubernetes/images/kubevirt-csi-driver, including its Linux-only test. I had looked only at the Dockerfile and the workflow file names and missed the Makefile target.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/ciIssues or PRs related to CI workflows, GitHub Actions, automationarea/testingIssues or PRs related to testing (e2e, bats, unit tests)kind/featureCategorizes issue or PR as related to a new featurepriority/important-longtermImportant over the long term, but may not be staffed and/or may need multiple releases to completequality-of-lifeQoL improvementstriage/acceptedIndicates an issue is ready to be actively worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions