Refactor build.yml comments and simplify Chunkah process
Updated comments and removed local patching of JSON for Chunkah run.
This commit is contained in:
@@ -95,7 +95,7 @@ jobs:
|
||||
set -x
|
||||
BASE_IMAGE="${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }}"
|
||||
|
||||
# 1. Das ostree-Label im Runner sichern, bevor wir das Image zerlegen
|
||||
# 1. Das originale ostree-Label im Runner auslesen und sichern
|
||||
OSTREE_DIFFID=$(podman inspect $BASE_IMAGE --format '{{index .Config.Labels "ostree.final-diffid"}}' 2>/dev/null || echo "")
|
||||
|
||||
# Rootfs extrahieren
|
||||
@@ -107,13 +107,7 @@ jobs:
|
||||
# Die originale Image-Config extrahieren
|
||||
podman inspect $BASE_IMAGE --format '{{json .Config}}' > ./chunkah-config.json
|
||||
|
||||
# LOKALER PATCH: Falls die DiffID existiert, schreiben wir sie via jq direkt in das JSON
|
||||
if [ ! -z "$OSTREE_DIFFID" ]; then
|
||||
jq --arg diffid "$OSTREE_DIFFID" '.Labels["ostree.final-diffid"] = $diffid' ./chunkah-config.json > ./chunkah-config-patched.json
|
||||
mv ./chunkah-config-patched.json ./chunkah-config.json
|
||||
fi
|
||||
|
||||
# Chunkah-Lauf (Übernimmt das lokal modifizierte JSON)
|
||||
# Chunkah-Lauf
|
||||
podman run --rm \
|
||||
-v ./chunkah-in:/inputs:z \
|
||||
-v ./chunkah-out:/outputs:z \
|
||||
@@ -127,6 +121,25 @@ jobs:
|
||||
--output /outputs/image.ociarchive \
|
||||
--rootfs /inputs
|
||||
|
||||
# 2. Das von Chunkah erzeugte Archiv wieder laden und das OCI-Label fest einbrennen
|
||||
if [ ! -z "$OSTREE_DIFFID" ]; then
|
||||
podman load -i ./chunkah-out/image.ociarchive
|
||||
|
||||
# dangling-ID des neuen Images greifen
|
||||
OPT_IMAGE_ID=$(podman images --filter "dangling=true" --format "{{.ID}}" | head -n 1)
|
||||
|
||||
# Ein modifiziertes OCI-Image mit Buildah erstellen (erhält die OCI-Struktur exakt aufrecht)
|
||||
BUILDAH_CONTAINER=$(buildah from $OPT_IMAGE_ID)
|
||||
buildah config --label "ostree.final-diffid=$OSTREE_DIFFID" $BUILDAH_CONTAINER
|
||||
|
||||
# Altes Archiv löschen und durch das final gelabelte OCI-Archiv ersetzen
|
||||
rm ./chunkah-out/image.ociarchive
|
||||
buildah commit --rm $BUILDAH_CONTAINER oci-archive:./chunkah-out/image.ociarchive
|
||||
|
||||
# Lokalen Speicher aufräumen
|
||||
podman rmi $OPT_IMAGE_ID || true
|
||||
fi
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v3
|
||||
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
|
||||
|
||||
Reference in New Issue
Block a user