Skip to content

STAC-25584: restore the omnibus git and bazel caches in the DEB build - #491

Open
LouisParkin wants to merge 2 commits into
stackstate-7.78.2from
STAC-25584-restore-omnibus-caches
Open

STAC-25584: restore the omnibus git and bazel caches in the DEB build#491
LouisParkin wants to merge 2 commits into
stackstate-7.78.2from
STAC-25584-restore-omnibus-caches

Conversation

@LouisParkin

Copy link
Copy Markdown

Only the Go module cache survived the port from GitLab (as the godeps-cache image). OMNIBUS_GIT_CACHE_DIR was not set at all, so tasks/omnibus.py disabled the git cache entirely, and nothing persisted the bazel caches — so every DEB build recompiles from source. About 31 of the 49 minutes of a green run is omnibus compile/fetch, paid twice per nightly across two architectures on self-hosted runners.

Setting OMNIBUS_GIT_CACHE_DIR cannot reach the S3 path upstream assumes: use_remote_cache also needs CI_JOB_NAME_SLUG and S3_OMNIBUS_GIT_CACHE_BUCKET, neither of which exists on GitHub, so the local cache is used and the KeyError in UPSTREAM_MERGE.md stays unreachable.

Writes are bounded rather than a one-to-one port of the GitLab layers, because the repo cache is capped at 10 GB with LRU eviction: keys are content-addressed with no run id and save is gated on a non-exact restore, saves are skipped on pull_request, and only bazelisk, bazel/install and the repository cache are persisted — not the whole output_user_root.

Reviewer check: because saves are skipped on PRs, this PR can only show that omnibus stops reporting OMNIBUS_GIT_CACHE_DIR as missing and that the restore steps are harmless. The speed-up itself is only observable on the second default-branch build after merge.

Jira: https://stackstate.atlassian.net/browse/STAC-25584

LouisParkin and others added 2 commits August 21, 2026 15:46
Only the Go module cache survived the port from GitLab, re-implemented as the
godeps-cache image (STAC-25429). The omnibus git cache and the bazel caches
were dropped, so every DEB build recompiles from source: summing the omnibus
Builder/NetFetcher timings in a green run, roughly 31 of the 49 minutes is
compile/fetch, and bazelisk rebuilds openssl (140s) and zlib (30s) every time.
That is paid twice per nightly across two architectures on self-hosted runners.

OMNIBUS_GIT_CACHE_DIR was not set at all, so tasks/omnibus.py disabled the git
cache entirely. Setting it cannot reach the S3 path that upstream assumes:
use_remote_cache additionally requires CI_JOB_NAME_SLUG and
S3_OMNIBUS_GIT_CACHE_BUCKET, and neither exists on GitHub, so the local cache
is used and the KeyError documented in UPSTREAM_MERGE.md stays unreachable.
The --install-directory /opt/stackstate-agent override is what keeps the cache
path branded; without it the post-build purge would git -C against a
nonexistent /opt/datadog-agent.

Cache writes are deliberately bounded rather than a one-to-one port of the
GitLab layers. The repository cache is capped at 10 GB with LRU eviction, and
the omnibus git cache is the highest value per byte, so:

- keys are content-addressed (omnibus definitions, release.json; bazel version
  and lockfile) with no run id, and save is gated on a non-exact restore, so an
  unchanged build reuses the entry instead of writing a fresh multi-GB copy;
- saves are skipped on pull_request, so PRs read the cache without competing
  for the cap or paying the upload;
- only bazelisk, bazel/install and the repository cache are persisted, not the
  whole output_user_root.

XDG_CACHE_HOME now derives from BAZEL_CACHE_ROOT so the build and the cache
steps cannot drift apart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Setting OMNIBUS_GIT_CACHE_DIR makes omnibus's git cache reachable for the
first time on GitHub Actions, and its incremental cache step commits each
built software definition into the cache repository. The build container
runs as root with no user.name/user.email, so that commit aborted the
build with "unable to auto-detect email address".

The identity matches the one the repo already uses for bot commits in
tasks/libs/common/utils.py. Passing it through GIT_AUTHOR_*/GIT_COMMITTER_*
rather than `git config --global` keeps it scoped to the job and avoids
mutating the container's global git state.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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