Merge branch 'rpmdb-normalize' into 'main'

Use rpmdb-normalize, add rootfs tests

See merge request fedora/bootc/base-images!102
This commit is contained in:
Colin Walters 2025-02-28 15:11:42 +00:00
commit 77f33d9738
6 changed files with 38 additions and 7 deletions

View file

@ -12,12 +12,16 @@ variables:
build-minimal:
extends: .build-image
script: buildah build -f Containerfile --no-cache -t localhost/fedora-bootc:minimal ${PRIV_ARGS} --build-arg=manifest=fedora-minimal .
script: |
set -xeuo pipefail
buildah build -f Containerfile --no-cache -t localhost/fedora-bootc:minimal ${PRIV_ARGS} --build-arg=manifest=fedora-minimal .
cd tests/rootfs && buildah build -t localhost/test --from localhost/fedora-bootc:minimal
standard-build-and-test:
extends: .build-image
script: |
set -xeuo pipefail
buildah build --no-cache -t localhost/fedora-bootc ${PRIV_ARGS} .
(cd tests/rootfs && buildah build -t localhost/test --from localhost/fedora-bootc)
cd tests
buildah build -f Containerfile.test-derive --no-cache -t localhost/fedora-bootc-derived ${PRIV_ARGS} .

View file

@ -6,12 +6,9 @@ opt-usrlocal: "root"
# https://github.com/CentOS/centos-bootc/issues/167
machineid-compat: true
# Note that the default for c9s+ is sqlite; we can't rely on rpm being
# in the target (it isn't in minimal!) so turn this to host here. This
# does break the "hermetic build" aspect a bit. Maybe eventually
# what we should do is special case this and actually install RPM temporarily
# and then remove it...
rpmdb: host
rpmdb: target
# We never want rpmdb.sqlite-shm as it's unreproducible
rpmdb-normalize: true
ignore-removed-users:
- root

6
tests/rootfs/Dockerfile Normal file
View file

@ -0,0 +1,6 @@
# This should always be replaced with podman build --from.
FROM localhost/image-to-test as rootfs
FROM quay.io/centos/centos:stream10
COPY . /src
RUN --mount=type=bind,from=rootfs,target=/target-rootfs /src/run /target-rootfs

4
tests/rootfs/README.md Normal file
View file

@ -0,0 +1,4 @@
# rootfs tests
This is a set of scripts that sanity check the target
rootfs in a read-only fashion.

7
tests/rootfs/cases/rpmdb Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
set -xeuo pipefail
for d in usr/share/rpm usr/lib/sysimage/rpm; do
if test -d "$d"; then
test '!' -f "$d/rpmdb.sqlite-shm"
fi
done

13
tests/rootfs/run Executable file
View file

@ -0,0 +1,13 @@
#!/bin/bash
set -euo pipefail
srcdir=$(cd $(dirname $0) && pwd)
rootfs=$1
shift
cd $rootfs
for case in ${srcdir}/cases/*; do
if test -x "$case"; then
echo "Running $case"
$case
echo "ok $case"
fi
done