@@ -52,17 +52,18 @@ sealed_buildargs := "--build-arg=variant=" + variant + " --secret=id=secureboot_
5252# The default target: build the container image from current sources.
5353# Note commonly you might want to override the base image via e.g.
5454# `just build --build-arg=base=quay.io/fedora/fedora-bootc:42`
55- #
56- # This first builds RPMs via the `package` target, then injects them
5755# into the container image.
56+ #
57+ # Note you can set `BOOTC_SKIP_PACKAGE=1` in the environment to bypass this stage.
5858build : package _keygen && _pull-lbi-images
59- @ just _build-from-package target/ packages
60-
61- # Build container image using pre-existing packages from PATH.
62- # This skips the package build step - useful when packages are provided
63- # externally (e.g. downloaded from CI artifacts).
64- build-from-packages PATH : _keygen && _pull-lbi-images
65- @ just _build-from-package {{ PATH}}
59+ #!/ bin/ bash
60+ set -xeuo pipefail
61+ test -d target/ packages
62+ # Resolve to absolute path for podman volume mount
63+ # Use :z for SELinux relabeling
64+ pkg_path=$(realpath target/ packages)
65+ podman build --target=final -v " ${pkg_path}" :/ run/ packages:ro,z -t {{ base_img}} -bin {{ buildargs}} .
66+ ./ hack/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs}}
6667
6768# Pull images used by hack/lbi
6869_ pull-lbi-images :
@@ -93,36 +94,32 @@ fedora-coreos := "quay.io/fedora/fedora-coreos:testing-devel"
9394_ keygen :
9495 ./ hack/ generate-secureboot-keys
9596
96- # Internal helper: build container image from packages at PATH
97- _ build-from-package PATH :
98- #!/ bin/ bash
99- set -xeuo pipefail
100- # Resolve to absolute path for podman volume mount
101- # Use :z for SELinux relabeling
102- pkg_path=$(realpath " {{ PATH}} " )
103- podman build --target=final -v " ${pkg_path}" :/ run/ packages:ro,z -t {{ base_img}} -bin {{ buildargs}} .
104- ./ hack/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs}}
105-
10697# Build a sealed image from current sources.
10798build-sealed :
10899 @ just --justfile {{ justfile ()}} variant=composefs-sealeduki-sdboot build
109100
110- # Build packages (e.g. RPM) using a container buildroot
111- _ packagecontainer :
101+ # Build packages (e.g. RPM) into target/packages/
102+ # Any old packages will be removed.
103+ # Set BOOTC_SKIP_PACKAGE=1 in the environment to bypass this stage. We don't
104+ # yet have an accurate ability to avoid rebuilding this in CI yet.
105+ package :
112106 #!/ bin/ bash
113107 set -xeuo pipefail
108+ packages=target/ packages
109+ if test -n " ${BOOTC_SKIP_PACKAGE:-}" ; then
110+ if test ' !' -d " ${packages}" ; then
111+ echo " BOOTC_SKIP_PACKAGE is set, but missing ${packages}" 1 >&2 ; exit 1
112+ fi
113+ exit 0
114+ fi
114115 eval $(just _git-build-vars)
115116 echo " Building RPM with version: ${VERSION}"
116117 podman build {{ base_buildargs}} --build-arg=SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} --build-arg=pkgversion=${VERSION} -t localhost/ bootc-pkg --target=build .
117-
118- # Build packages (e.g. RPM) into target/packages/
119- # Any old packages will be removed.
120- package : _packagecontainer
121- mkdir -p target/ packages
122- rm -vf target/ packages/ *.rpm
123- podman run --rm localhost/ bootc-pkg tar -C / out/ -cf - . | tar -C target/ packages/ -xvf -
124- chmod a+ rx target target/ packages
125- chmod a+ r target/ packages/ *.rpm
118+ mkdir -p " ${packages}"
119+ rm -vf " ${packages}"/ *.rpm
120+ podman run --rm localhost/ bootc-pkg tar -C / out/ -cf - . | tar -C " ${packages}"/ -xvf -
121+ chmod a+ rx target " ${packages}"
122+ chmod a+ r " ${packages}"/ *.rpm
126123 # Keep localhost/bootc-pkg for layer caching; use `just clean-local-images` to reclaim space
127124
128125# Build+test using the `composefs-sealeduki-sdboot` variant.
0 commit comments