Skip to content

ci: STEP 2: BitBake S3 cache as tar.zst with fingerprint skip#349

Open
neo-jesse wants to merge 3 commits into
mainfrom
feat/ci-s3-bitbake-cache-zstd
Open

ci: STEP 2: BitBake S3 cache as tar.zst with fingerprint skip#349
neo-jesse wants to merge 3 commits into
mainfrom
feat/ci-s3-bitbake-cache-zstd

Conversation

@neo-jesse

@neo-jesse neo-jesse commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add .github/scripts/s3-bitbake-cache.sh for downloads / sstate / git as tar.zst (legacy zip fallback on pull).
  • Push skips archive+upload when a content fingerprint matches the remote *.manifest.
  • Harden pull/push error reporting and zstd install / zip fallback.
  • Wire the build workflow to use the helper instead of inline zip logic.

Test plan

  • Stage-dev warm build: pull finds caches, BitBake gets high sstate hit rate
  • Unchanged cache: push logs fingerprint skip for each type
  • Missing zstd on runner: falls back to zip without failing the job hard

neo-jesse and others added 2 commits July 13, 2026 11:13
Surface AWS errors, check object existence before download, install or
fall back from zstd, and avoid silent cold builds when cache is missing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Comment thread .github/scripts/s3-bitbake-cache.sh Outdated
Comment on lines +17 to +51
ensure_tools() {
if command -v zstd >/dev/null 2>&1; then
ARCHIVE_FORMAT=zstd
log "Using zstd ($(command -v zstd))"
return 0
fi

log "zstd not found; attempting install..."
if command -v dnf >/dev/null 2>&1; then
sudo dnf install -y zstd || true
elif command -v yum >/dev/null 2>&1; then
sudo yum install -y zstd || true
elif command -v apt-get >/dev/null 2>&1; then
sudo apt-get update -qq || true
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq zstd || true
fi

# Refresh command hash in case the package just landed on PATH.
hash -r 2>/dev/null || true

if command -v zstd >/dev/null 2>&1; then
ARCHIVE_FORMAT=zstd
log "Using zstd after install ($(command -v zstd))"
return 0
fi

if command -v zip >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1; then
ARCHIVE_FORMAT=zip
log "WARNING: zstd unavailable; falling back to zip for cache archives"
return 0
fi

log "ERROR: neither zstd nor zip/unzip is available" >&2
return 1
}

@y3rsh y3rsh Jul 13, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not mind a simple check here but I don't like a catch all installer. I think we should understand if our ephemeral custom runners will or will not have zstd and reconcile them to have it where we control that reconciliation. From a quick check it looks like almost all standard github runners do have it, just FYI.
This check can then simply be print the version or fail if not present.
I also think we don't need any backwards compatibility. When this merges I expect no cache hit and new caches built and pushed according to this new pattern.

We want the code in this file as simple and straightforward as possible to make it clear to all maintainers exactly how we build, bust, write, and use the caches for this job.

Require zstd on the runner (print version or fail), drop zip/legacy
fallback and installers, and document pull/push/fingerprint clearly.

Co-authored-by: Cursor <cursoragent@cursor.com>
@neo-jesse neo-jesse changed the title ci: BitBake S3 cache as tar.zst with fingerprint skip ci: STEP 2: BitBake S3 cache as tar.zst with fingerprint skip Jul 13, 2026
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.

2 participants