🤖 ci: replace e2e smoke test with CNPG + Templates merge-queue E2E#76
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 917309104d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Addresses review feedback: the skip condition was too broad (github.event_name != 'merge_group'), which would also skip on direct pushes to main, allowing publish without E2E validation. Changed to github.event_name == 'pull_request' so the full E2E runs on both merge_group and push events.
|
@codex review Addressed the feedback: narrowed the E2E skip gate from |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 597d7398e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Use the v1.25.0 git tag instead of the release-1.25 branch ref for deterministic CI builds.
|
@codex review Addressed both review comments:
|
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Replace the existing lightweight Kind smoke test (
e2e-kind) with a full end-to-end test that provisions CloudNativePG, a realCoderControlPlane, the aggregated API server, and validatesCoderTemplatecreation viakubectl.Background
The previous
e2e-kindjob only verified that aCoderControlPlaneCR could be created (no real Postgres, no Coder deployment, no aggregated API). This left significant integration gaps uncovered by CI.This PR wires up the full stack in the merge queue (
merge_groupevent) while keeping the job as a fast no-op on PRs so the required check stays green without wasting resources.Implementation
config/e2e/deployment.yaml--app=controller→--app=allto run both controller and aggregated API server in the same pod.APIServiceto reach the aggregated API server).config/e2e/codertemplate.yaml(new)CoderTemplatemanifest for the E2E test to apply viakubectl.default.<name>naming convention with a trivial Terraformnull_resource..github/workflows/ci.yaml(e2e-kindjob)E2E (Kind + CNPG + Templates)(ide2e-kindunchanged for branch protection).::notice::message.CoderTemplateand verify it exists viakubectlValidation
actionlint: no errors in CI workflowRisks
release-1.25/releases/cnpg-1.25.0.yaml.📋 Implementation Plan
Plan: Merge-queue E2E (Kind + CloudNativePG + CoderTemplates)
Context / Why
We want an end-to-end test that can run in GitHub’s merge queue (
merge_group) to ensure:coder-k8s(controller) can reconcile a realCoderControlPlanebacked by PostgreSQL.kubectlto create and retrieveCoderTemplateresources (served by the aggregated API server and backed by the Coder API).This replaces the current Kind “smoke” test that only verifies a
CoderControlPlaneCR can be created.Evidence (repo facts)
.github/workflows/ci.yaml(jobe2e-kind).config/e2e/deployment.yaml.APIService.insecureSkipTLSVerify: true:deploy/apiserver-service.yamldeploy/apiserver-apiservice.yamlexamples/cloudnativepg/00-namespace.yamlexamples/cloudnativepg/cnpg-cluster.yamlexamples/cloudnativepg/codercontrolplane.yamlCoderControlPlanein the request namespace and reads operator URL/token from status+Secret (Explore report: “CoderTemplate Aggregated API Usage Guide”).CoderTemplatecreate path can uploadspec.filesas a zip, create a template version, then create the template (no synchronous wait in codersdk):internal/aggregated/storage/template.go.Implementation details
1) Enable aggregated API server in the e2e Deployment
File:
config/e2e/deployment.yamlChange e2e deployment from controller-only to
--app=alland expose the HTTPS port used by the APIService.Proposed diff shape:
Rationale: the
deploy/apiserver-service.yamltargets port 6443 on pods labeledapp: coder-k8s.2) Add an E2E
CoderTemplatemanifestNew file:
config/e2e/codertemplate.yamlCreate a minimal template in the same namespace as the E2E
CoderControlPlane(the existing CNPG example usesnamespace: coder).Notes:
metadata.namemust be<org>.<template-name>andspec.organizationmust match the<org>prefix (enforced server-side).3) Replace the CI Kind smoke job with full CNPG + templates E2E
File:
.github/workflows/ci.yaml3.1 Keep the job identity stable
Keep the job id
e2e-kind(and ideally keep thename:similar) so that existing branch protection / required checks don’t unexpectedly change.3.2 Runtime control: run full E2E in merge queue only
Full CNPG + Coder bring-up will be materially slower than the current smoke test.
Recommended approach:
e2e-kindjob running on PRs (so the check exists), but make it a fast no-op.github.event_name == 'merge_group'.This satisfies “only run it in the merge queue” while still allowing the check to be configured as required.
Implementation pattern:
If you do want some signal on PRs, a compromise is to keep the old smoke steps under
pull_requestand the full E2E undermerge_group.3.3 Full merge-queue E2E steps (merge_group only)
Replace the existing “apply sample CR and verify it exists” with:
ghcr.io/coder/coder-k8s:e2eimage (existing)kubectl apply -f config/e2e/namespace.yamlkubectl apply -f config/crd/bases/kubectl apply -f config/rbac/kubectl apply -f deploy/apiserver-service.yamlkubectl apply -f deploy/apiserver-apiservice.yamlcoder-k8s(updatedconfig/e2e/deployment.yaml)kubectl wait --for=condition=Available deploy/coder-k8s -n coder-system --timeout=120skubectl wait --for=condition=Available apiservice/v1alpha1.aggregation.coder.com --timeout=180skubectl apply --server-side -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.25/releases/cnpg-1.25.0.yamlkubectl wait --for=condition=Available deploy/cnpg-controller-manager -n cnpg-system --timeout=180skubectl apply -f examples/cloudnativepg/kubectl -n coder wait --for=condition=Ready cluster/coder-db --timeout=10mkubectl -n coder rollout status deployment/coder --timeout=10mkubectl -n coder wait --for=jsonpath='{.status.phase}'=Ready codercontrolplane/coder --timeout=10mkubectl -n coder wait --for=jsonpath='{.status.operatorAccessReady}'=true codercontrolplane/coder --timeout=10mkubectl apply -f config/e2e/codertemplate.yamlkubectl -n coder get codertemplateskubectl -n coder get codertemplate default.e2e-template -o yaml3.4 Add failure diagnostics (high value for flake triage)
Add
if: failure()steps to dump state:kubectl get pods -Akubectl describe apiservice v1alpha1.aggregation.coder.comkubectl -n coder-system logs deploy/coder-k8s --tail=200kubectl -n coder describe codercontrolplane coderkubectl -n coder logs deploy/coder --tail=200(best-effort)kubectl -n cnpg-system logs deploy/cnpg-controller-manager --tail=2004) Make it required for merge queue completion
This is a repo settings change (not a code change): mark the check run name (e.g.,
E2E (Kind + CNPG + Templates)) as a required status check on the protected branch that uses merge queue.Keep the job id/name stable to avoid having to reconfigure required checks.
Validation plan (when implementing)
hack/kind-dev.sh+kubectl applycommands.e2e-kindcompletes quickly (skipped heavy steps) and is green.merge_group): full E2E runs, createsCoderControlPlane+CoderTemplate, and succeeds.Generated with
mux• Model:anthropic:claude-opus-4-6• Thinking:xhigh• Cost:$1.34