Skip to content

ci(docker): fix Argument list too long when signing bake outputs#283

Merged
chopratejas merged 1 commit intomainfrom
ci-fix-docker-bake-arg-list-too-long
Apr 27, 2026
Merged

ci(docker): fix Argument list too long when signing bake outputs#283
chopratejas merged 1 commit intomainfrom
ci-fix-docker-bake-arg-list-too-long

Conversation

@chopratejas
Copy link
Copy Markdown
Owner

Summary

  • Cosign signing step in publish-docker / docker-variant-tags was failing for the code-nonroot and runtime-code-nonroot bake targets with Argument list too long.
  • Root cause: BAKE_META: \${{ steps.bake.outputs.metadata }} was passed as an env var. For those large variants the JSON metadata pushes combined argv+env past Linux ARG_MAX (~128 KiB on ubuntu-latest), so bash dies with E2BIG before the script body can run.
  • Fix: write metadata into \${RUNNER_TEMP}/bake_meta.json via a single-quoted heredoc and feed it to jq from disk. Heredoc bodies live in the script (read by bash from a temp file), so they don't count against env size.

Failing run

Test plan

  • make ci-precheck (commitlint, ruff, mypy, pytest, cargo fmt/clippy/test) green locally before push
  • On this PR, the publish-docker / docker-variant-tags matrix succeeds for all 8 variants — including code-nonroot and runtime-code-nonroot
  • Cosign signatures land in \${REGISTRY}/\${image}-signatures as before; verify by checking package version listing on GHCR after merge

The cosign signing step passed bake metadata via env var:

  env:
    BAKE_META: ${{ steps.bake.outputs.metadata }}
  run: echo "$BAKE_META" | jq ...

For large bake targets (code-nonroot, runtime-code-nonroot) the
metadata JSON is large enough that combined argv+env at bash spawn
exceeds Linux ARG_MAX (~128 KiB on ubuntu-latest), so bash dies with
E2BIG before the script even runs.

Switch to writing metadata into a heredoc-backed temp file, then read
it via jq file input. Heredocs put the JSON in the script body itself,
which bash reads from a temp file (no ARG_MAX limit), bypassing the
env-size ceiling entirely.

Module: .github/workflows/docker.yml
@chopratejas chopratejas merged commit e0f372f into main Apr 27, 2026
20 checks passed
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