Skip to content

ci(k8s-e2e): cut execution qualification provisioning time - #2434

Merged
rdimitrov merged 1 commit into
ci/shard-k8s-execution-e2efrom
ci/k8s-e2e-faster-provisioning
Oct 20, 2026
Merged

rdimitrov merged 1 commit into
ci/shard-k8s-execution-e2efrom
ci/k8s-e2e-faster-provisioning

Conversation

@rdimitrov

@rdimitrov rdimitrov commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Depends on #2432 (stacked on its branch, which touches the same k8s-e2e.yml and run.sh).

Summary

Cuts per-shard provisioning of execution-production-e2e from ~11-12 min to ~4 min, bringing the k8s-e2e workflow's wall-clock from 23m20s to 13m01s with the same tests.

Provisioning was almost all cold Go compiles:

  • Job-owned Go cache. The shared setup-go entry (same key as ci.yml and the sibling k8s e2e (kind) job) never matched ko's -trimpath compiles, and the execution shards lost the race to save it. The execution job now restores its own ~/go/pkg/mod + ~/.cache/go-build entry keyed on Go version + go.sum hashes (about 1.4GB). Only shard 1 saves it, and only outside pull requests, once per go.sum (the key is immutable). PRs read main's entry, so PR runs add nothing to the repo's 10GB cache budget.
  • Host compiles reuse ko's packages. go run ./deploy/execution-templates took 146s in the deployment phase because it compiled cold while competing with the test-binary build. It and go test -c now use ko's CGO_ENABLED=0 -trimpath configuration. Measured locally from a ko-warm cache: templates tool 7s vs 41s.
  • Test binary compiles earlier. It starts right after the ko builds, overlapping the base pull, Docker builds, and archive loads, rather than after the images phase. Its timeout guard went from 5m to 8m to cover a cold cache under more CPU contention.
  • One archive for the workload family. The workload image and both derivatives share the Go base layers, so they are saved and loaded in one archive (--multi-image-archive on podman).

cert-manager was considered and left alone: its install is 23s of the deployment phase.

Measurements (per shard, seconds)

Phase Before (39389618485) Cold cache (39394007570) Warm cache (39396317476)
images 400-446 324 109-110
↳ ko builds ~220-250 ~195 ~15
↳ workload/derivative/incompatible load ~105 47 38-39
deployment 200-221 63 55-59
test binary wait 30-39 0 0 (compile 4-7s)
tests ~560 ~500 468-512
shard job 21-23 min 16-17 min 12m41s-12m58s
workflow 23m20s 23m30s* 13m01s

* In the cold run the unrelated k8s e2e (kind) job was the slowest at 18m30s. In the warm run it took 10m22s.

Eviction risk: the repo's Actions cache is already over its 10GB limit (13.9GB), and GitHub evicts the least recently used entries first. This branch's entry was evicted within about an hour, so dispatch run 39403108418 ran cold (~17-19 min). On main, every PR run reads the entry, which keeps it recently used, but pruning stale PR-ref setup-go entries would make this more reliable.

PRs get the warm numbers once a push to main has saved the entry. After a go.sum change, the first run restores the previous entry via restore-keys, so only changed modules recompile.

Test plan

  • go test ./deploy/mecatl-execution-kind/... ./deploy/execution-templates/... in golang:1.27.2 (with jq). The scriptRange fixtures were updated for the moved compile block, the new compile flags, and the multi-image save.
  • actionlint .github/workflows/k8s-e2e.yml
  • task lint: one gosec G703 finding in environment/microvm/launch_ownership_darwin.go. That macOS-only file is untouched here and isn't in the Linux CI lint.
  • Two workflow_dispatch runs on this branch (cold, then warm), all jobs green.

🤖 Generated with Claude Code

@rdimitrov
rdimitrov force-pushed the ci/k8s-e2e-faster-provisioning branch from a2ee421 to 81bf395 Compare October 20, 2026 09:46
rdimitrov added a commit that referenced this pull request Oct 20, 2026
The previous wait matched status.hard to spec.hard, but #2434's warm-cache
run still hit Forbidden on the first create: the API server also requires
status.used for every listed resource, and the ExecutionEnvironment count is
only computed once the quota controller discovers the newly installed CRD.
Wait until every spec.hard key has a matching status.hard value and a
status.used entry (the same condition failure-evidence.jq reports), and log
how long the wait took.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov
rdimitrov force-pushed the ci/k8s-e2e-faster-provisioning branch 2 times, most recently from b688eaa to 08a835d Compare October 20, 2026 10:50
Give the execution shards a job-owned Go module and build cache, saved once
per go.sum by shard 1 outside pull requests. The shared setup-go entry never
warmed ko's -trimpath compiles and lost its save race to the sibling job.

Compile the host-side templates tool and qualification test binary with
ko's CGO_ENABLED=0 -trimpath configuration so they reuse ko's packages, and
start the test compile right after the ko builds. Load the workload and its
two derivatives, which share the Go base layers, from one archive.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@rdimitrov
rdimitrov force-pushed the ci/k8s-e2e-faster-provisioning branch from 08a835d to 160f184 Compare October 20, 2026 11:19
@rdimitrov
rdimitrov merged commit 160f184 into ci/shard-k8s-execution-e2e Oct 20, 2026
39 checks passed
@rdimitrov
rdimitrov deleted the ci/k8s-e2e-faster-provisioning branch October 20, 2026 11:33
@rdimitrov
rdimitrov restored the ci/k8s-e2e-faster-provisioning branch October 20, 2026 11:34
@rdimitrov

Copy link
Copy Markdown
Member Author

Folded into #2432: #2432's branch was fast-forwarded to this PR's head (160f184), which GitHub records as merging this PR into that branch. All of these changes now land on main through #2432. The branch was auto-deleted on merge and has been restored at the same commit.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant