feat: Add bootc support (#448)

Adds support for using `bootc` as the preferred method for booting from
a locally created image. This new method gets rid of the need to create
a tarball and move it to the correct place and instead it will make use
of `podman scp` which copies the image to the root `containers-storage`
and then has `rpm-ostree` and `bootc` boot from that store.

Closes #418 
Closes #200
This commit is contained in:
Gerald Pinder 2025-08-09 14:05:59 -04:00 committed by GitHub
parent 2c525854c9
commit 3a0be4099a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 2991 additions and 1857 deletions

View file

@ -43,8 +43,8 @@ build-full:
switch:
FROM +test-base
RUN mkdir -p /etc/bluebuild && touch $BB_TEST_LOCAL_IMAGE
RUN --no-cache bluebuild -v switch recipes/recipe.yml
RUN --no-cache bluebuild -v switch --boot-driver rpm-ostree recipes/recipe.yml
RUN --no-cache bluebuild -v switch --boot-driver bootc recipes/recipe.yml
validate:
FROM +test-base
@ -92,7 +92,7 @@ init:
legacy-base:
FROM ../+blue-build-cli --RELEASE=false
ENV BB_TEST_LOCAL_IMAGE=/etc/bluebuild/cli_test-legacy.tar.gz
ENV BB_TEST_LOCAL_IMAGE=localhost/cli/test:latest
ENV CLICOLOR_FORCE=1
COPY ./mock-scripts/ /usr/bin/
@ -103,13 +103,14 @@ legacy-base:
DO ../+INSTALL --OUT_DIR="/usr/bin/" --BUILD_TARGET="x86_64-unknown-linux-musl" --TAGGED="true"
DO +GEN_KEYPAIR
ENV USER=root
test-base:
FROM ../+blue-build-cli --RELEASE=false
RUN git config --global user.email "you@example.com" && \
git config --global user.name "Your Name"
ENV BB_TEST_LOCAL_IMAGE=/etc/bluebuild/cli_test.tar.gz
ENV BB_TEST_LOCAL_IMAGE=localhost/cli/test:latest
ENV CLICOLOR_FORCE=1
ARG MOCK="true"
@ -121,6 +122,7 @@ test-base:
COPY ./test-repo /test
DO +GEN_KEYPAIR
ENV USER=root
GEN_KEYPAIR:
FUNCTION

View file

@ -0,0 +1,41 @@
#!/bin/bash
set -euo pipefail
if [ "$1" = "switch" ]; then
if [[ "$2" == "--transport=containers-storage" && "$3" == "$BB_TEST_LOCAL_IMAGE" ]]; then
echo "Rebased to local image $BB_TEST_LOCAL_IMAGE"
else
echo "Failed to rebase"
exit 1
fi
elif [ "$1" = "upgrade" ]; then
echo "Performing upgrade for $BB_TEST_LOCAL_IMAGE"
elif [ "$1" = "status" ]; then
cat <<EOF
{
"status": {
"staged": null,
"booted": {
"image": {
"image": {
"image": "ghcr.io/blue-build/cli/test",
"transport": "registry"
}
}
},
"rollback": {
"image": {
"image": {
"image": "ghcr.io/blue-build/cli/test",
"transport": "registry"
}
}
}
}
}
EOF
else
echo "Arg $1 is not recognized"
exit 1
fi

View file

@ -13,6 +13,10 @@ main() {
echo "Exporting image to a tarball (JK JUST A MOCK!)"
echo "${tarpath}"
touch $tarpath
elif [[ "$1" == "image" && "$2" == "scp" ]]; then
echo "Copying image $3 to $4"
elif [[ "$1" == "rmi" && "$2" == "$BB_TEST_LOCAL_IMAGE" ]]; then
echo "Removing image $2"
else
echo 'Running podman'
fi

View file

@ -3,11 +3,11 @@
set -euo pipefail
if [ "$1" = "rebase" ]; then
if [ "$2" = "ostree-unverified-image:oci-archive:$BB_TEST_LOCAL_IMAGE" ]; then
if [ "$2" = "ostree-unverified-image:containers-storage:$BB_TEST_LOCAL_IMAGE" ]; then
echo "Rebased to local image $BB_TEST_LOCAL_IMAGE"
else
echo "Failed to rebase"
exit 1
echo "Failed to rebase"
exit 1
fi
elif [ "$1" = "upgrade" ]; then
echo "Performing upgrade for $BB_TEST_LOCAL_IMAGE"

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-arm64
description: This is my personal OS image.
base-image: quay.io/fedora/fedora-silverblue
base-image: quay.io/fedora/fedora-bootc
image-version: latest
stages:
- from-file: stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-buildah
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: latest
stages:
- from-file: stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-docker-external
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: latest
stages:
- from-file: stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: 40
stages:
- from-file: invalid-stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-invalid-module
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: 40
stages:
- from-file: stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-invalid-stage
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: 40
stages:
- name: ubuntu-test

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-invalid
description: 10
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version:
- 40
- 39

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-podman
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: latest
stages:
- from-file: stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test-rechunk
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: latest
stages:
- from-file: stages.yml

View file

@ -2,7 +2,7 @@
# yaml-language-server: $schema=https://schema.blue-build.org/recipe-v1.json
name: cli/test
description: This is my personal OS image.
base-image: ghcr.io/ublue-os/silverblue-main
base-image: quay.io/fedora/fedora-bootc
image-version: latest
stages:
- from-file: stages.yml