Skip to content

Commit 164d3b2

Browse files
committed
Add vfs/chroot build test to aio container
Ref: containers/buildah#5988 Having this test in the AIO build is merely a convenience, as it will exercise both buildah and podman packages as they appear in their respective purpose-built images. Signed-off-by: Chris Evich <[email protected]>
1 parent f27333a commit 164d3b2

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

aio/test.sh

+25-1
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,26 @@ trap "podman unshare rm -rf '$TMPD'" EXIT
6363
msg "Loading test image"
6464
showrun podman load -i $HOME/$FQIN_FILE
6565

66-
# These tests come directly from the aio/README.md examples
66+
6767
mkdir $TMPD/cntr_storage
6868
mkdir $TMPD/context
69+
6970
echo -e 'FROM registry.fedoraproject.org/fedora-minimal:latest\nENV TESTING=true' > $TMPD/context/Containerfile
71+
# Contents printed on build, mask test string 'Fo0b@r' for rwmount build test
72+
cat << EOF > $TMPD/context/Containerfile.rwmount
73+
FROM registry.fedoraproject.org/fedora-minimal:latest as base
74+
RUN mkdir -p /var/tmp/test
75+
ADD ./Containerfile /var/tmp/test/
76+
77+
FROM base as final
78+
RUN --mount=type=bind,from=base,src=/var/tmp/test,dst=/var/tmp/test,rw \
79+
set -x && \
80+
echo -e '\x46\x6f\x30\x62\x40\x72' > /var/tmp/test/Containerfile && \
81+
cat /var/tmp/test/Containerfile
82+
EOF
83+
7084
for tool in buildah podman; do
85+
# The next two tests come directly from the aio/README.md examples
7186
msg "Verify $tool can create a simple image as root inside $FQIN"
7287
showrun podman unshare rm -rf $TMPD/cntr_storage/* $TMPD/cntr_storage/.??*
7388
showrun podman run -i --rm --net=host --security-opt label=disable --privileged \
@@ -84,4 +99,13 @@ for tool in buildah podman; do
8499
-v $TMPD/cntr_storage:/home/user/.local/share/containers:Z \
85100
-v $TMPD/context:/home/user/context:Z \
86101
$FQIN $tool build -t rootless_testimage /home/user/context
102+
103+
# Verify problematic rwmount build functions
104+
# This type of build is frequently done w/in CI systems
105+
msg "Verify $tool can perform a vfs/chroot build inside $FQIN"
106+
showrun podman run -i --rm \
107+
-v $TMPD/context:/root/context:Z \
108+
$FQIN $tool --storage-driver=vfs build --isolation=chroot -t rwmount_testimage -f Containerfile.rwmount /root/context \
109+
| tee $TMPD/rwmount.output
110+
showrun grep -Fqx 'Fo0b@r' $TMPD/rwmount.output
87111
done

0 commit comments

Comments
 (0)