From d250137b71c046c43d116c4f1807ee5dba812a7b Mon Sep 17 00:00:00 2001 From: Wesley van Tilburg Date: Fri, 27 Feb 2026 22:21:40 +0100 Subject: [PATCH] ci: test changes --- .gitea/workflows/build.yaml | 81 +++++++++++++++++++++++++------------ builder.sh | 7 +++- 2 files changed, 60 insertions(+), 28 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 584a3fd..61a50f1 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -15,23 +15,28 @@ jobs: fail-fast: false matrix: image: [asahi-cosmic] - version: [43] #Build current stable,next stable/rawhide (if not branched) + version: [43] + container: image: "quay.io/fedora-ostree-desktops/buildroot:${{ matrix.version }}" options: "--security-opt=label=disable --privileged --user 0:0 --device=/dev/fuse --volume /:/run/host:rw" + steps: - - name: Install latest rpm-ostree package from testing repos + - name: Install rpm-ostree + tools run: | dnf upgrade -y --enablerepo=updates-testing --refresh rpm-ostree - dnf install -y nodejs + dnf install -y nodejs skopeo jq mkdir -p ~/.docker - + - name: Fix containers/storage.conf + run: | + sed -i 's/driver = "overlay"/driver = "vfs"/' /usr/share/containers/storage.conf + - name: Checkout uses: actions/checkout@v4 - - name: Log in + - name: Log in to registry uses: redhat-actions/podman-login@v1 with: registry: git.plabble.org @@ -39,27 +44,51 @@ jobs: password: ${{ secrets.REGISTRY_TOKEN }} auth_file_path: /tmp/auth.json - - name: Build rootfs + - name: Build OCI archive with rpm-ostree run: | - sudo ./builder.sh asahi-cosmic 43 + sudo ./builder.sh "${{ matrix.image }}" "${{ matrix.version }}" - - name: Build container - id: build - uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef - with: - image: misthios/${{ matrix.image }} - tags: ${{ matrix.version }} - containerfiles: ./Containerfile - build-args: IMAGE=${{ matrix.image }} + - name: Push OCI archive to registry + run: | + set -xeuo pipefail - - name: Push - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.build.outputs.image }} - tags: ${{ steps.build.outputs.tags }} - registry: git.plabble.org - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - extra-args: | - --compression-format=zstd - --compression-level=12 + IMAGE="${{ matrix.image }}" + VERSION="${{ matrix.version }}" + REGISTRY="git.plabble.org/misthios" + + ARCHIVE="images/${IMAGE}/manifest.ociarchive" + + # Build ID (YYYYMMDD.0) + if [[ -f ".buildid" ]]; then + buildid="$(< .buildid)" + else + buildid="$(date '+%Y%m%d.0')" + echo "${buildid}" > .buildid + fi + + # Extract version from os-release mutation + version="$(rpm-ostree compose tree --print-only --repo=repo images/${IMAGE}/manifest.yaml | jq -r '."mutate-os-release"')" + + full_tag="${version}.${buildid}" + + echo "Pushing ${ARCHIVE} → ${REGISTRY}/${IMAGE}:${full_tag}" + + # Push OCI archive directly (preserves SUID, ownership, labels) + skopeo copy \ + --authfile /tmp/auth.json \ + --retry-times 3 \ + --dest-compress-format zstd \ + oci-archive:${ARCHIVE} \ + docker://${REGISTRY}/${IMAGE}:${full_tag} + + # Also push version-only tag + skopeo copy \ + --authfile /tmp/auth.json \ + --retry-times 3 \ + --dest-compress-format zstd \ + docker://${REGISTRY}/${IMAGE}:${full_tag} \ + docker://${REGISTRY}/${IMAGE}:${version} + + echo "Pushed:" + echo " - ${REGISTRY}/${IMAGE}:${full_tag}" + echo " - ${REGISTRY}/${IMAGE}:${version}" diff --git a/builder.sh b/builder.sh index a6475c5..0b26ca2 100755 --- a/builder.sh +++ b/builder.sh @@ -25,7 +25,10 @@ if [[ ! -f "$MANIFEST" ]]; then echo "Manifest not found: $MANIFEST" exit 1 fi - +if [[ -d "$OUTPUT" ]]; then + echo "Removing stale OCI directory: $OUTPUT" + rm -rf "$OUTPUT" +fi # --- PREPARE OSTREE REPO --- mkdir -p repo cache if [[ ! -f "repo/config" ]]; then @@ -70,7 +73,7 @@ ARGS=( "--cachedir=cache" ) -rpm-ostree compose rootfs \ +rpm-ostree compose image \ "${ARGS[@]}" \ "$MANIFEST" \ "$OUTPUT"