@@ -25,6 +25,8 @@ base := env("BOOTC_base", "quay.io/centos-bootc/centos-bootc:stream10")
2525buildroot_base := env (" BOOTC_buildroot_base" , " quay.io/centos/centos:stream10" )
2626
2727testimage_label := " bootc.testimage=1"
28+ # Images used by hack/lbi; keep in sync
29+ lbi_images := " quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.access.redhat.com/ubi9/podman:latest"
2830# We used to have --jobs=4 here but sometimes that'd hit this
2931# ```
3032# [2/3] STEP 2/2: RUN --mount=type=bind,from=context,target=/run/context <<EORUN (set -xeuo pipefail...)
@@ -34,21 +36,23 @@ testimage_label := "bootc.testimage=1"
3436# /bin/sh: line 3: cd: /run/context/: Permission denied
3537# ```
3638# TODO: Gather more info and file a buildah bug
37- base_buildargs := " "
38- buildargs := " --build-arg=base=" + base + " --build-arg=variant=" + variant
39-
40- # Build the container image from current sources.
39+ generic_buildargs := " "
40+ # Args for package building (no secrets needed, just builds RPMs)
41+ base_buildargs := generic_buildargs + " --build-arg=base=" + base + " --build-arg=variant=" + variant
42+ buildargs := base_buildargs + " --secret=id=secureboot_key,src=target/test-secureboot/db.key --secret=id=secureboot_cert,src=target/test-secureboot/db.crt"
43+ # Args for build-sealed (no base arg, it sets that itself)
44+ sealed_buildargs := " --build-arg=variant=" + variant + " --secret=id=secureboot_key,src=target/test-secureboot/db.key --secret=id=secureboot_cert,src=target/test-secureboot/db.crt"
45+
46+ # The default target: build the container image from current sources.
4147# Note commonly you might want to override the base image via e.g.
4248# `just build --build-arg=base=quay.io/fedora/fedora-bootc:42`
43- build : package
49+ build : package _keygen
4450 podman build {{ base_buildargs}} -t {{ base_img}} -bin {{ buildargs}} .
45- ./ tests / build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ buildroot_base }}
51+ ./ hack / build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs }}
4652
47- # Build the container image using pre-existing packages from PATH
48- build-from-package PATH :
49- # @just copy-packages-from {{PATH}}
50- podman build {{ base_buildargs}} -t {{ base_img}} -bin {{ buildargs}} .
51- ./ tests/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ buildroot_base}}
53+ # Generate Secure Boot keys (only for our own CI/testing)
54+ _ keygen :
55+ ./ hack/ generate-secureboot-keys
5256
5357# Build a sealed image from current sources.
5458build-sealed :
@@ -69,7 +73,7 @@ _packagecontainer:
6973 VERSION=" ${TIMESTAMP}.g${COMMIT}"
7074 fi
7175 echo " Building RPM with version: ${VERSION}"
72- podman build {{ base_buildargs}} {{ buildargs }} --build-arg=pkgversion=${VERSION} -t localhost/ bootc-pkg --target=build .
76+ podman build {{ base_buildargs}} --build-arg=pkgversion=${VERSION} -t localhost/ bootc-pkg --target=build .
7377
7478# Build packages (e.g. RPM) into target/packages/
7579# Any old packages will be removed.
@@ -96,20 +100,28 @@ copy-packages-from PATH:
96100 chmod a+ rx target target/ packages
97101 chmod a+ r target/ packages/ *.rpm
98102
103+ # Build the container image using pre-existing packages from PATH
104+ # Note: The Dockerfile reads from target/packages/, so copy the packages there first
105+ # if they're in a different location.
106+ build-from-package PATH : _keygen
107+ @ if [ " {{ PATH}} " != " target/packages" ]; then just copy-packages-from {{ PATH}} ; fi
108+ podman build {{ base_buildargs}} -t {{ base_img}} -bin {{ buildargs}} .
109+ ./ hack/ build-sealed {{ variant}} {{ base_img}} -bin {{ base_img}} {{ sealed_buildargs}}
110+
111+ # Pull images used by hack/lbi
112+ _ pull-lbi-images :
113+ podman pull -q --retry 5 --retry-delay 5 s {{ lbi_images}}
114+
99115# This container image has additional testing content and utilities
100- build-integration-test-image : build
116+ build-integration-test-image : build _pull-lbi-images
101117 cd hack && podman build {{ base_buildargs}} -t {{ integration_img}} -bin -f Containerfile .
102- ./ tests/ build-sealed {{ variant}} {{ integration_img}} -bin {{ integration_img}} {{ buildroot_base}}
103- # Keep these in sync with what's used in hack/lbi
104- podman pull -q --retry 5 --retry-delay 5 s quay.io/ curl/ curl:latest quay.io/ curl/ curl-base:latest registry.access.redhat.com/ ubi9/ podman:latest
118+ ./ hack/ build-sealed {{ variant}} {{ integration_img}} -bin {{ integration_img}} {{ sealed_buildargs}}
105119
106120# Build integration test image using pre-existing packages from PATH
107- build-integration-test-image-from-package PATH :
121+ build-integration-test-image-from-package PATH : _pull-lbi-images
108122 @ just build-from-package {{ PATH}}
109123 cd hack && podman build {{ base_buildargs}} -t {{ integration_img}} -bin -f Containerfile .
110- ./ tests/ build-sealed {{ variant}} {{ integration_img}} -bin {{ integration_img}} {{ buildroot_base}}
111- # Keep these in sync with what's used in hack/lbi
112- podman pull -q --retry 5 --retry-delay 5 s quay.io/ curl/ curl:latest quay.io/ curl/ curl-base:latest registry.access.redhat.com/ ubi9/ podman:latest
124+ ./ hack/ build-sealed {{ variant}} {{ integration_img}} -bin {{ integration_img}} {{ sealed_buildargs}}
113125
114126# Build+test using the `composefs-sealeduki-sdboot` variant.
115127test-composefs :
@@ -146,7 +158,7 @@ test-tmt *ARGS: build-integration-test-image _build-upgrade-image
146158# Generate a local synthetic upgrade
147159_ build-upgrade-image :
148160 cat tmt/ tests/ Dockerfile.upgrade | podman build -t {{ integration_upgrade_img}} -bin --from={{ integration_img}} -bin -
149- ./ tests / build-sealed {{ variant}} {{ integration_upgrade_img}} -bin {{ integration_upgrade_img}} {{ buildroot_base }}
161+ ./ hack / build-sealed {{ variant}} {{ integration_upgrade_img}} -bin {{ integration_upgrade_img}} {{ sealed_buildargs }}
150162
151163# Assume the localhost/bootc-integration image is up to date, and just run tests.
152164# Useful for iterating on tests quickly.
0 commit comments