Skip to content

[chore] more speedups for build-and-test-experimental#48426

Open
TylerHelmuth wants to merge 10 commits into
open-telemetry:mainfrom
TylerHelmuth:investigate-slow-build-steps
Open

[chore] more speedups for build-and-test-experimental#48426
TylerHelmuth wants to merge 10 commits into
open-telemetry:mainfrom
TylerHelmuth:investigate-slow-build-steps

Conversation

@TylerHelmuth
Copy link
Copy Markdown
Member

@TylerHelmuth TylerHelmuth commented May 15, 2026

Description

Speeds up build-and-test-experimental:

  • Skip gomoddownload for cross-compile-affected and the read-only-checks shard — neither needs every module pre-downloaded; what they touch is fetched lazily.
  • make gomoddownload: -j2-j8. Network-bound on the 4 vCPU runner; helps every cold-cache run.
  • Shard codegen from one job into 16 codegen-<group> shards (one per module group). make generate learns to honor GROUP.

Example run: https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/25942633975

Speedups under test:
- setup-go-tools: bump `make -j2 gomoddownload` to `-j8` so the
  upfront module download (the dominant cost when the GHA cache is
  cold, which is the common case in contrib) parallelizes more.
- cross-compile-affected: skip the upfront `gomoddownload` entirely.
  The job only builds the affected module set, so `go build` can
  fetch what it needs lazily.
- exp-checks/read-only-checks shard: skip `gomoddownload` and
  `make genotelcontribcol` -- checkdoc/checkmetadata/checkapi/
  multimod-verify don't need either.

CRITICAL_FILES temporarily drops `^.github/workflows/` and
`^.github/actions/` so this PR runs in scoped mode while iterating
on the workflow itself. To be restored before merge.

Touches processor/filterprocessor so scoped mode has an affected
module to exercise the cross-compile-affected job.
checkdoc/checkmetadata/checkapi depend on cmd/otelcontribcol/components.go
(via the checkfile build-tool). Restore `make genotelcontribcol` for that
shard while keeping the `gomoddownload: false` skip.
Convert the root `make generate` from a serial shell loop
(`for-all CMD="go generate ./..."`) over ~500 modules to the
parallelizable `for-all-target` pattern with `-j8`. Adds a small
`generate-mod` submodule target so each module's `go generate ./...`
runs as a real make target instead of a shell-iterated command.

mdatagen output lives under each module's internal/metadata and
isn't imported across modules, so per-module generation is
independent and parallel-safe.
The codegen parallelization edit modifies Makefile.Common, which was
forcing the test PR back into full mode. Temporary, restore before
merge along with the workflow/action exclusions.
`go generate ./...` invokes `//go:generate make mdatagen` directives.
With the outer `make -j8` providing a jobserver, the make spawned by
`go generate` (one process boundary away via go's exec) sees MAKEFLAGS
but can't reach the jobserver pipe, producing:

  make[3]: warning: jobserver unavailable: using -j1.

Clear MAKEFLAGS for the duration of `go generate` so the inner make
doesn't try to use the jobserver in the first place. mdatagen is a
single command anyway, so losing parallelism there changes nothing.
Replace the single `codegen` exp-checks shard with one per module
group (codegen-receiver-0, codegen-processor-0, ..., codegen-other).
Each shard runs `make generate GROUP=<group>` over only its subset,
parallelizing the work across matrix runners instead of within a
single make invocation (which was tried in d6dd840 and reverted
because the per-module recursive make overhead exceeded the benefit).

Adds a GROUP-aware path to the `generate` target: when GROUP is set
at SRC_ROOT, dispatch via `$(FOR_GROUP_TARGET) TARGET=generate` so
each submodule's existing generate recipe handles its own
`go generate ./... + fmt + gci`. When GROUP is unset, behavior is
unchanged (for-all + batched gofmt/gogci).

run-checks-shard.sh maps `codegen-<group>` → `make generate
GROUP=<group>`, then runs the existing git-clean check.
@TylerHelmuth TylerHelmuth changed the title [chore] test gomoddownload speedups in scoped CI [chore] more speedups for build-and-test-experimental May 15, 2026
Drop the test-only changes used to exercise scoped mode while
iterating on the workflow:
- Restore ^.github/workflows/, ^.github/actions/, ^Makefile, and
  ^Makefile.Common entries in CRITICAL_FILES.
- Revert the no-op edit to processor/filterprocessor/doc.go.
@TylerHelmuth TylerHelmuth marked this pull request as ready for review May 15, 2026 21:50
@TylerHelmuth TylerHelmuth requested a review from a team as a code owner May 15, 2026 21:50
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.

3 participants