ci: test changes
All checks were successful
Build containers / Build and push image (asahi-cosmic, 43) (push) Successful in 9m43s
All checks were successful
Build containers / Build and push image (asahi-cosmic, 43) (push) Successful in 9m43s
This commit is contained in:
@@ -15,51 +15,96 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
image: [asahi-cosmic]
|
image: [asahi-cosmic]
|
||||||
version: [43] #Build current stable,next stable/rawhide (if not branched)
|
version: [43]
|
||||||
|
|
||||||
container:
|
container:
|
||||||
image: "quay.io/fedora-ostree-desktops/buildroot:${{ matrix.version }}"
|
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"
|
options: "--security-opt=label=disable --privileged --user 0:0 --device=/dev/fuse --volume /:/run/host:rw"
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Install latest rpm-ostree package from testing repos
|
- name: Install rpm-ostree + tools
|
||||||
run: |
|
run: |
|
||||||
dnf upgrade -y --enablerepo=updates-testing --refresh rpm-ostree
|
dnf upgrade -y --enablerepo=updates-testing --refresh rpm-ostree
|
||||||
dnf install -y nodejs
|
dnf install -y nodejs skopeo jq buildah rsync
|
||||||
mkdir -p ~/.docker
|
mkdir -p ~/.docker
|
||||||
|
|
||||||
|
- name: Fix containers/storage.conf
|
||||||
|
run: |
|
||||||
|
sed -i 's/driver = "overlay"/driver = "vfs"/' /usr/share/containers/storage.conf
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Log in
|
- name: Log in to registry
|
||||||
uses: redhat-actions/podman-login@v1
|
uses: redhat-actions/podman-login@v1
|
||||||
with:
|
with:
|
||||||
registry: git.plabble.org
|
registry: git.plabble.org
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
auth_file_path: /tmp/auth.json
|
auth_file_path: /tmp/auth.json
|
||||||
|
|
||||||
- name: Build rootfs
|
- name: Build rootfs with rpm-ostree
|
||||||
run: |
|
run: |
|
||||||
sudo ./builder.sh asahi-cosmic 43
|
cd "$GITHUB_WORKSPACE"
|
||||||
|
sudo -E ./builder.sh "${{ matrix.image }}" "${{ matrix.version }}"
|
||||||
|
|
||||||
- name: Build container
|
- name: Build and push OCI image from rootfs
|
||||||
id: build
|
run: |
|
||||||
uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef
|
set -xeuo pipefail
|
||||||
with:
|
|
||||||
image: misthios/${{ matrix.image }}
|
|
||||||
tags: ${{ matrix.version }}
|
|
||||||
containerfiles: ./Containerfile
|
|
||||||
build-args: IMAGE=${{ matrix.image }}
|
|
||||||
|
|
||||||
- name: Push
|
IMAGE="${{ matrix.image }}"
|
||||||
uses: redhat-actions/push-to-registry@v2
|
VERSION="${{ matrix.version }}"
|
||||||
with:
|
REGISTRY="git.plabble.org/misthios"
|
||||||
image: ${{ steps.build.outputs.image }}
|
ROOTFS="images/${IMAGE}/rootfs"
|
||||||
tags: ${{ steps.build.outputs.tags }}
|
|
||||||
registry: git.plabble.org
|
if [[ ! -d "${ROOTFS}" ]]; then
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
echo "ERROR: rootfs not found at ${ROOTFS}"
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
exit 1
|
||||||
extra-args: |
|
fi
|
||||||
--compression-format=zstd
|
|
||||||
--compression-level=12
|
# Build ID (YYYYMMDD.0)
|
||||||
|
if [[ -f ".buildid" ]]; then
|
||||||
|
buildid="$(< .buildid)"
|
||||||
|
else
|
||||||
|
buildid="$(date '+%Y%m%d.0')"
|
||||||
|
echo "${buildid}" > .buildid
|
||||||
|
fi
|
||||||
|
|
||||||
|
version="${VERSION}"
|
||||||
|
full_tag="${version}.${buildid}"
|
||||||
|
|
||||||
|
echo "Building OCI image from rootfs..."
|
||||||
|
|
||||||
|
export STORAGE_DRIVER=vfs
|
||||||
|
|
||||||
|
ctr="$(buildah from scratch)"
|
||||||
|
mnt="$(buildah mount "${ctr}")"
|
||||||
|
|
||||||
|
rsync -aHAX "${ROOTFS}/" "${mnt}/"
|
||||||
|
|
||||||
|
# REQUIRED FOR BOOTC
|
||||||
|
buildah config --label containers.bootc=1 "${ctr}"
|
||||||
|
buildah config --env container=oci "${ctr}"
|
||||||
|
|
||||||
|
# CMD
|
||||||
|
buildah config --cmd "/sbin/init" "${ctr}"
|
||||||
|
|
||||||
|
buildah commit "${ctr}" "localhost/${IMAGE}:${full_tag}"
|
||||||
|
buildah unmount "${ctr}"
|
||||||
|
|
||||||
|
echo "Pushing image to registry..."
|
||||||
|
|
||||||
|
skopeo copy \
|
||||||
|
--authfile /tmp/auth.json \
|
||||||
|
containers-storage:localhost/${IMAGE}:${full_tag} \
|
||||||
|
docker://${REGISTRY}/${IMAGE}:${full_tag}
|
||||||
|
|
||||||
|
skopeo copy \
|
||||||
|
--authfile /tmp/auth.json \
|
||||||
|
containers-storage:localhost/${IMAGE}:${full_tag} \
|
||||||
|
docker://${REGISTRY}/${IMAGE}:${version}
|
||||||
|
|
||||||
|
echo "Pushed:"
|
||||||
|
echo " - ${REGISTRY}/${IMAGE}:${full_tag}"
|
||||||
|
echo " - ${REGISTRY}/${IMAGE}:${version}"
|
||||||
|
|||||||
11
builder.sh
11
builder.sh
@@ -1,7 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
# Usage: ./builder.sh <image-name> <version>
|
|
||||||
if [[ $# -lt 2 ]]; then
|
if [[ $# -lt 2 ]]; then
|
||||||
echo "Usage: $0 <image-name> <version>"
|
echo "Usage: $0 <image-name> <version>"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -12,7 +11,7 @@ VERSION="$2"
|
|||||||
|
|
||||||
IMAGE_DIR="images/${IMAGE}"
|
IMAGE_DIR="images/${IMAGE}"
|
||||||
MANIFEST="${IMAGE_DIR}/manifest.yaml"
|
MANIFEST="${IMAGE_DIR}/manifest.yaml"
|
||||||
OUTPUT="${IMAGE_DIR}/manifest.ociarchive"
|
ROOTFS="${IMAGE_DIR}/rootfs"
|
||||||
REF="images/${IMAGE}/${VERSION}"
|
REF="images/${IMAGE}/${VERSION}"
|
||||||
|
|
||||||
# --- CHECKS ---
|
# --- CHECKS ---
|
||||||
@@ -48,11 +47,9 @@ cp images/shared/*.repo "${IMAGE_DIR}/"
|
|||||||
cp "${IMAGE_DIR}"/repos/*.repo "${IMAGE_DIR}/"
|
cp "${IMAGE_DIR}"/repos/*.repo "${IMAGE_DIR}/"
|
||||||
|
|
||||||
# --- MANIFEST FIXUPS ---
|
# --- MANIFEST FIXUPS ---
|
||||||
# Remove existing ref: and releasever:
|
|
||||||
sed -i '/^ref:/d' "$MANIFEST"
|
sed -i '/^ref:/d' "$MANIFEST"
|
||||||
sed -i '/^releasever:/d' "$MANIFEST"
|
sed -i '/^releasever:/d' "$MANIFEST"
|
||||||
|
|
||||||
# Insert new values at top
|
|
||||||
sed -i "1i releasever: ${VERSION}" "$MANIFEST"
|
sed -i "1i releasever: ${VERSION}" "$MANIFEST"
|
||||||
sed -i "1i ref: ${REF}" "$MANIFEST"
|
sed -i "1i ref: ${REF}" "$MANIFEST"
|
||||||
|
|
||||||
@@ -65,12 +62,14 @@ else
|
|||||||
echo "No postprocess.sh found in ${IMAGE_DIR}, skipping."
|
echo "No postprocess.sh found in ${IMAGE_DIR}, skipping."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# --- COMPOSE IMAGE ---
|
# --- COMPOSE ROOTFS ---
|
||||||
ARGS=(
|
ARGS=(
|
||||||
"--cachedir=cache"
|
"--cachedir=cache"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rm -rf "${ROOTFS:?}"
|
||||||
|
|
||||||
rpm-ostree compose rootfs \
|
rpm-ostree compose rootfs \
|
||||||
"${ARGS[@]}" \
|
"${ARGS[@]}" \
|
||||||
"$MANIFEST" \
|
"$MANIFEST" \
|
||||||
"$OUTPUT"
|
"$ROOTFS"
|
||||||
|
|||||||
Reference in New Issue
Block a user