Skip to content

Fix sign job failure in container publish workflow by handling multiline tag outputs safely - #1198

Merged
hyphaltip merged 8 commits into
masterfrom
copilot/fix-github-actions-job-sign
Aug 11, 2026
Merged

Fix sign job failure in container publish workflow by handling multiline tag outputs safely#1198
hyphaltip merged 8 commits into
masterfrom
copilot/fix-github-actions-job-sign

Conversation

Copilot AI commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

The Build and Sign Container Image workflow was failing in the sign job because ${{ needs.build.outputs.tags }} is multiline and was expanded directly in a shell for loop, producing invalid bash syntax. This PR updates tag consumption and related signing/provenance logic to be robust for multi-tag releases.

  • Root cause addressed

    • Replaced direct interpolation loops like for tag in ${{ needs.build.outputs.tags }} with line-safe iteration over an env-provided multiline string.
  • Workflow loop hardening (sign, provenance, verify)

    • Added TAGS env wiring from needs.build.outputs.tags.
    • Iterates with printf '%s\n' "$TAGS" | while IFS= read -r tag; do ...; done.
    • Skips empty lines defensively.
  • Shell interpolation safety + output cleanup

    • Moved GitHub expression values used in shell (ref_name, ref_type, repo/ref) into step env variables before command use.
    • Removed redundant nested redirection when writing version to $GITHUB_OUTPUT.
  • Supply-chain verification/provenance tightening

    • cosign verify now pins certificate identity to this exact workflow and ref.
    • SLSA buildType now includes workflow ref (@${GITHUB_REF}) for versioned provenance identity.
env:
  TAGS: ${{ needs.build.outputs.tags }}
run: |
  printf '%s\n' "$TAGS" | while IFS= read -r tag; do
    [ -n "$tag" ] || continue
    cosign sign --yes --recursive "$tag"
  done

Copilot AI and others added 7 commits August 11, 2026 04:48
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Co-authored-by: hyphaltip <48827+hyphaltip@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix failing GitHub Actions job sign Fix sign job failure in container publish workflow by handling multiline tag outputs safely Aug 11, 2026
Copilot AI requested a review from hyphaltip August 11, 2026 04:54
@hyphaltip
hyphaltip marked this pull request as ready for review August 11, 2026 05:10
@hyphaltip
hyphaltip merged commit c70c705 into master Aug 11, 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