mirror of
https://github.com/containers/bootc.git
synced 2026-02-05 15:45:53 +01:00
build-sys: Consolidate test image content into base
Move all content from the derived test image (hack/Containerfile) into the main Dockerfile base image. This includes nushell, cloud-init, and the other testing packages from packages.txt. This simplifies the build by avoiding the need to juggle multiple images during testing workflows - the base image now contains everything needed. Assisted-by: OpenCode (Claude Sonnet 4) Signed-off-by: Colin Walters <walters@verbum.org> # Conflicts: # hack/Containerfile
This commit is contained in:
@@ -15,6 +15,8 @@
|
|||||||
!docs/
|
!docs/
|
||||||
# We use the spec file
|
# We use the spec file
|
||||||
!contrib/
|
!contrib/
|
||||||
|
# This is used to add content on top of our default base
|
||||||
|
!hack/
|
||||||
# The systemd units and baseimage bits end up in installs
|
# The systemd units and baseimage bits end up in installs
|
||||||
!systemd/
|
!systemd/
|
||||||
!baseimage/
|
!baseimage/
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ RUN /usr/libexec/bootc-base-imagectl build-rootfs --manifest=standard /target-ro
|
|||||||
|
|
||||||
FROM scratch as base
|
FROM scratch as base
|
||||||
COPY --from=target-base /target-rootfs/ /
|
COPY --from=target-base /target-rootfs/ /
|
||||||
|
COPY --from=src /src/hack/ /run/hack/
|
||||||
|
RUN cd /run/hack/ && ./provision-derived.sh
|
||||||
# Note we don't do any customization here yet
|
# Note we don't do any customization here yet
|
||||||
# Mark this as a test image
|
# Mark this as a test image
|
||||||
LABEL bootc.testimage="1"
|
LABEL bootc.testimage="1"
|
||||||
|
|||||||
@@ -7,37 +7,10 @@ FROM scratch as context
|
|||||||
# We only need this stuff in the initial context
|
# We only need this stuff in the initial context
|
||||||
COPY . /
|
COPY . /
|
||||||
|
|
||||||
# An intermediate layer which caches the extended RPMS
|
|
||||||
FROM localhost/bootc as extended
|
|
||||||
# And this layer has additional stuff for testing, such as nushell etc.
|
|
||||||
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
|
|
||||||
set -xeuo pipefail
|
|
||||||
cd /run/context/
|
|
||||||
./provision-derived.sh
|
|
||||||
EORUN
|
|
||||||
|
|
||||||
# And the configs
|
# And the configs
|
||||||
FROM extended
|
FROM localhost/bootc
|
||||||
ARG SKIP_CONFIGS
|
|
||||||
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
|
RUN --mount=type=bind,from=context,target=/run/context <<EORUN
|
||||||
# Do not need the configs when testing installation on ostree
|
|
||||||
echo "SKIP_CONFIGS=${SKIP_CONFIGS:-<unset>}"
|
|
||||||
if [ -n "${SKIP_CONFIGS:-}" ]; then
|
|
||||||
echo "Skipping configs installation"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
set -xeuo pipefail
|
set -xeuo pipefail
|
||||||
cd /run/context
|
cd /run/context
|
||||||
# For test-22-logically-bound-install
|
|
||||||
cp -a lbi/usr/. /usr
|
|
||||||
for x in curl.container curl-base.image podman.image; do
|
|
||||||
ln -s /usr/share/containers/systemd/$x /usr/lib/bootc/bound-images.d/$x
|
|
||||||
done
|
|
||||||
|
|
||||||
# Add some testing kargs into our dev builds
|
|
||||||
install -D -t /usr/lib/bootc/kargs.d test-kargs/*
|
|
||||||
# Also copy in some default install configs we use for testing
|
|
||||||
install -D -t /usr/lib/bootc/install/ install-test-configs/*
|
|
||||||
# Finally, test our own linting
|
|
||||||
bootc container lint --fatal-warnings
|
bootc container lint --fatal-warnings
|
||||||
EORUN
|
EORUN
|
||||||
|
|||||||
@@ -29,18 +29,7 @@ cp test-artifacts.repo /etc/yum.repos.d/
|
|||||||
dnf -y update bootc
|
dnf -y update bootc
|
||||||
# Required by tmt avc checking after test
|
# Required by tmt avc checking after test
|
||||||
dnf -y install audit
|
dnf -y install audit
|
||||||
./provision-derived.sh cloudinit
|
./provision-derived.sh
|
||||||
|
|
||||||
# For test-22-logically-bound-install
|
|
||||||
cp -a lbi/usr/. /usr
|
|
||||||
for x in curl.container curl-base.image podman.image; do
|
|
||||||
ln -s /usr/share/containers/systemd/$x /usr/lib/bootc/bound-images.d/$x
|
|
||||||
done
|
|
||||||
|
|
||||||
# Add some testing kargs into our dev builds
|
|
||||||
install -D -t /usr/lib/bootc/kargs.d test-kargs/*
|
|
||||||
# Also copy in some default install configs we use for testing
|
|
||||||
install -D -t /usr/lib/bootc/install/ install-test-configs/*
|
|
||||||
|
|
||||||
# Remove bootc repo, bootc updated already
|
# Remove bootc repo, bootc updated already
|
||||||
rm -rf /var/share/test-artifacts /etc/yum.repos.d/test-artifacts.repo
|
rm -rf /var/share/test-artifacts /etc/yum.repos.d/test-artifacts.repo
|
||||||
|
|||||||
@@ -4,13 +4,6 @@ set -xeu
|
|||||||
# using it in our test suite because it's better than bash. First,
|
# using it in our test suite because it's better than bash. First,
|
||||||
# enable EPEL to get it.
|
# enable EPEL to get it.
|
||||||
|
|
||||||
cloudinit=0
|
|
||||||
case ${1:-} in
|
|
||||||
cloudinit) cloudinit=1 ;;
|
|
||||||
"") ;;
|
|
||||||
*) echo "Unhandled flag: ${1:-}" 1>&2; exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Ensure this is pre-created
|
# Ensure this is pre-created
|
||||||
mkdir -p -m 0700 /var/roothome
|
mkdir -p -m 0700 /var/roothome
|
||||||
mkdir -p ~/.config/nushell
|
mkdir -p ~/.config/nushell
|
||||||
@@ -51,9 +44,8 @@ grep -Ev -e '^#' packages.txt | xargs dnf -y install
|
|||||||
cat <<KARGEOF >> /usr/lib/bootc/kargs.d/20-console.toml
|
cat <<KARGEOF >> /usr/lib/bootc/kargs.d/20-console.toml
|
||||||
kargs = ["console=ttyS0,115200n8"]
|
kargs = ["console=ttyS0,115200n8"]
|
||||||
KARGEOF
|
KARGEOF
|
||||||
if test $cloudinit = 1; then
|
dnf -y install cloud-init
|
||||||
dnf -y install cloud-init
|
ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants
|
||||||
ln -s ../cloud-init.target /usr/lib/systemd/system/default.target.wants
|
|
||||||
# Allow root SSH login for testing with bcvk/tmt
|
# Allow root SSH login for testing with bcvk/tmt
|
||||||
mkdir -p /etc/cloud/cloud.cfg.d
|
mkdir -p /etc/cloud/cloud.cfg.d
|
||||||
cat > /etc/cloud/cloud.cfg.d/80-enable-root.cfg <<'CLOUDEOF'
|
cat > /etc/cloud/cloud.cfg.d/80-enable-root.cfg <<'CLOUDEOF'
|
||||||
@@ -67,7 +59,6 @@ growpart:
|
|||||||
devices: ["/sysroot"]
|
devices: ["/sysroot"]
|
||||||
resize_rootfs: false
|
resize_rootfs: false
|
||||||
CLOUDEOF
|
CLOUDEOF
|
||||||
fi
|
|
||||||
|
|
||||||
dnf clean all
|
dnf clean all
|
||||||
# Stock extra cleaning of logs and caches in general (mostly dnf)
|
# Stock extra cleaning of logs and caches in general (mostly dnf)
|
||||||
@@ -122,3 +113,14 @@ d /var/lib/dhclient 0755 root root - -
|
|||||||
EOF
|
EOF
|
||||||
rm -rf /var/lib/dhclient
|
rm -rf /var/lib/dhclient
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# For test-22-logically-bound-install
|
||||||
|
cp -a lbi/usr/. /usr
|
||||||
|
for x in curl.container curl-base.image podman.image; do
|
||||||
|
ln -s /usr/share/containers/systemd/$x /usr/lib/bootc/bound-images.d/$x
|
||||||
|
done
|
||||||
|
|
||||||
|
# Add some testing kargs into our dev builds
|
||||||
|
install -D -t /usr/lib/bootc/kargs.d test-kargs/*
|
||||||
|
# Also copy in some default install configs we use for testing
|
||||||
|
install -D -t /usr/lib/bootc/install/ install-test-configs/*
|
||||||
|
|||||||
Reference in New Issue
Block a user