@@ -526,53 +526,33 @@ jobs:
526526 fi
527527 echo "==> MAX_LAYERS=${MAX_LAYERS}"
528528
529- # podman inspect produces the array format chunkah's parse_config accepts.
530- # Must use LABELED (has labels) not INPUT (pre-label image).
531- export CHUNKAH_CONFIG_STR
532- CHUNKAH_CONFIG_STR=$(podman inspect "${LABELED}" | jq -c '.[0]')
533-
534- # podman build internally uses Buildah code but ships as part of podman 5.x
535- # (installed via Homebrew above). All flags are identical to buildah build.
536- #
537- # Custom Containerfile replaces the upstream Containerfile.splitter URL
538- # to inject a user.component xattr on the rootfs before chunkah scans it.
539- # chunkah requires at least one "component repo" (xattr, rpmdb, or
540- # bigfiles >= 1MB). Flatpak manifest.yaml apps (e.g. Kontainer) may have
541- # no large files and no rpmdb, so bigfiles and rpm repos both return None.
542- # Setting user.component on / activates the xattr repo; all files inherit
543- # it via directory inheritance. The mount uses rw so setfattr can write to
544- # the overlay layer. attr (setfattr) is installed from Fedora 43 (~1s).
545- CHUNKAH_CONTAINERFILE=$(mktemp)
546- printf '%s\n' \
547- 'ARG CHUNKAH=quay.io/jlebon/chunkah:latest' \
548- 'ARG CHUNKAH_ARGS=""' \
549- 'ARG CHUNKAH_CONFIG_STR' \
550- 'ARG APP_ID="app"' \
551- '' \
552- 'FROM overridden AS target' \
553- 'FROM ${CHUNKAH} AS chunkah' \
554- 'ARG CHUNKAH_CONFIG_STR' \
555- 'ARG CHUNKAH_ARGS' \
556- 'ARG APP_ID' \
557- 'RUN --mount=type=bind,target=/run/src,rw \' \
558- ' --mount=from=target,target=/chunkah,rw \' \
559- ' dnf5 install -y --setopt=install_weak_deps=False --nodocs attr \' \
560- ' && setfattr -n user.component -v "${APP_ID}" /chunkah \' \
561- ' && chunkah build ${CHUNKAH_ARGS} > /run/src/out.ociarchive' \
562- '' \
563- 'FROM oci-archive:out.ociarchive' \
564- > "${CHUNKAH_CONTAINERFILE}"
565- echo "==> Running chunkah via podman build"
566- podman build \
567- --skip-unused-stages=false \
568- --from "${LABELED}" \
569- -t "${CHUNKED}" \
570- -v "$(pwd):/run/src" \
571- --security-opt=label=disable \
572- --build-arg CHUNKAH_CONFIG_STR \
573- --build-arg "CHUNKAH_ARGS=--max-layers ${MAX_LAYERS}" \
574- --build-arg "APP_ID=${APP}" \
575- -f "${CHUNKAH_CONTAINERFILE}"
529+ # Per-app chunkah skip: x-skip-chunkah: true in manifest.yaml bypasses chunkah
530+ # entirely (CHUNKED == LABELED). Use for small apps with no rpmdb and no files
531+ # >= 1MB — chunkah fails with "no supported component repo found in rootfs".
532+ SKIP_CHUNKAH="false"
533+ if [[ -f "flatpaks/${APP}/manifest.yaml" ]]; then
534+ SKIP_CHUNKAH=$(yq '.["x-skip-chunkah"] // false' "flatpaks/${APP}/manifest.yaml")
535+ fi
536+
537+ if [[ "${SKIP_CHUNKAH}" == "true" ]]; then
538+ echo "==> Skipping chunkah (x-skip-chunkah: true in manifest.yaml)"
539+ CHUNKED="${LABELED}"
540+ else
541+ # podman inspect produces the array format chunkah's parse_config accepts.
542+ # Must use LABELED (has labels) not INPUT (pre-label image).
543+ export CHUNKAH_CONFIG_STR
544+ CHUNKAH_CONFIG_STR=$(podman inspect "${LABELED}" | jq -c '.[0]')
545+ echo "==> Running chunkah"
546+ podman run --rm \
547+ --mount=type=image,src="${LABELED}",dst=/chunkah \
548+ -e CHUNKAH_CONFIG_STR \
549+ quay.io/jlebon/chunkah:v0.3.0 build \
550+ --max-layers "${MAX_LAYERS}" \
551+ > "${APP}.ociarchive"
552+ CHUNKED_ID=$(podman load < "${APP}.ociarchive" | grep -oP '(?<=sha256:)[a-f0-9]+' | head -1)
553+ podman tag "${CHUNKED_ID}" "${CHUNKED}"
554+ rm -f "${APP}.ociarchive"
555+ fi
576556
577557 # Verify labels survived the round-trip
578558 podman inspect "${CHUNKED}" \
@@ -581,9 +561,13 @@ jobs:
581561 echo "==> Flatpak labels OK"
582562 LAYER_COUNT=$(podman inspect "${CHUNKED}" | jq '.[0].RootFS.Layers | length')
583563 echo "==> Layer count: ${LAYER_COUNT}"
584- [[ "${LAYER_COUNT}" -gt 1 ]] \
585- && echo "==> chunkah split succeeded" \
586- || echo "==> WARNING: chunkah produced only 1 layer"
564+ if [[ "${SKIP_CHUNKAH}" == "true" ]]; then
565+ echo "==> chunkah skipped (x-skip-chunkah: true) — single layer expected"
566+ else
567+ [[ "${LAYER_COUNT}" -gt 1 ]] \
568+ && echo "==> chunkah split succeeded" \
569+ || echo "==> WARNING: chunkah produced only 1 layer"
570+ fi
587571 # Export for use in subsequent steps
588572 echo "CHUNKED=${CHUNKED}" >> "$GITHUB_ENV"
589573 echo "LAYER_COUNT=${LAYER_COUNT}" >> "$GITHUB_ENV"
0 commit comments