Skip to content

feat(export-dynamic): reject hollow OCI payloads before push - #182

Open
polasudo wants to merge 3 commits into
redhat-developer:mainfrom
polasudo:feat/hollow-oci-export-gate
Open

polasudo wants to merge 3 commits into
redhat-developer:mainfrom
polasudo:feat/hollow-oci-export-gate

Conversation

@polasudo

@polasudo polasudo commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add validate-plugin-payload.sh with (dist-dynamic package + entry) and (non-empty io.backstage.dynamic-packages, with layer index.json fallback).
  • Wire both into export-dynamic.sh so hollow exports land in failed-exports and are not pushed to ghcr / listed in published-exports.
  • Add offline unit tests, optional local podman OCI smoke, CI workflow, and a short README section.

Test plan

  • bash export-dynamic/validate-plugin-payload.test.sh (unit + local podman Gate 2 smoke)
  • CI Test validate-plugin-payload workflow green on this PR
  • After merge: smoke one known-good overlay workspace /publish and one intentionally broken export; confirm failed-exports blocks push

Made with Cursor

polasudo and others added 3 commits October 9, 2026 14:18
Fail incomplete dist-dynamic exports and empty io.backstage.dynamic-packages
images into failed-exports so overlay publish does not push garbage to ghcr.

Co-authored-by: Cursor <cursoragent@cursor.com>
Frontend scalprum exports use dist/remoteEntry.js, not backend index.cjs.js.
Verified locally against community-plugins bookmarks via export-dynamic.sh.

Co-authored-by: Cursor <cursoragent@cursor.com>
Stop swallowing export-dynamic.sh exit codes with || true so export-only
runs cannot succeed when dist-dynamic/OCI payload validation fails.
Keep detailed failed-exports reporting via always() in the workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

mkdir -pv "${packDestination}"

# Gate 1 again for archive-only clarity (already passed above after export)
if ! assert_dist_dynamic_payload "$(pwd)/dist-dynamic"; then

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.

do we expect that dist-dynamic will be empty at this point or is the AI hallucinating here?

fi
fi

if command -v skopeo >/dev/null 2>&1 && skopeo inspect "oci-archive:${archive}" >/dev/null 2>&1; then

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.

performance issue: you're inspecting the same container twice, and you're not using --no-tags either time.

rewrite so you only call skopeo inspect --no-tags once and then use the result of that, if positive, with jq & sed

return 1
fi
mkdir -p "${tmpdir}/layer"
if ! tar xzf "$blob" -C "${tmpdir}/layer" 2>/dev/null && ! tar xf "$blob" -C "${tmpdir}/layer" 2>/dev/null; then

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.

do we anticipate needing both zipped and non-zipped artifacts here?

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