Integration tests: use cached images more

Attempt to make more thorough use of cached copies of images during
integration tests, except in tests which need to pull a new image while
they're running, either because they test pulling directly, or because
they expect to pull a given image for a non-default platform or for
multiple platforms.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
This commit is contained in:
Nalin Dahyabhai 2024-03-29 16:46:47 -04:00
parent b213c5e7a1
commit c7f0881422
7 changed files with 103 additions and 20 deletions

View File

@ -265,7 +265,7 @@ stuff/mystuff"
}
@test "add from image" {
_prefetch busybox
_prefetch busybox ubuntu
run_buildah from --quiet $WITH_POLICY_JSON busybox
cid=$output
run_buildah add --quiet $WITH_POLICY_JSON --from ubuntu $cid /etc/passwd /tmp/passwd # should pull the image, absolute path

View File

@ -8,6 +8,7 @@ load helpers
}
@test "bud stdio is usable pipes" {
_prefetch alpine
run_buildah build $BUDFILES/stdio
}
@ -134,6 +135,7 @@ _EOF
@test "bud: build push with --force-compression" {
skip_if_no_podman
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -178,19 +180,22 @@ _EOF
}
@test "build with inline RUN --network=host" {
_prefetch alpine
#hostns=$(readlink /proc/self/ns/net)
run readlink /proc/self/ns/net
hostns="$output"
run_buildah build $WITH_POLICY_JSON -t source -f $BUDFILES/inline-network/Dockerfile1
expect_output --from="${lines[8]}" "${hostns}"
expect_output --from="${lines[2]}" "${hostns}"
}
@test "build with inline RUN --network=none" {
_prefetch alpine
run_buildah 1 build $WITH_POLICY_JSON -t source -f $BUDFILES/inline-network/Dockerfile2
expect_output --substring "wget: bad address"
}
@test "build with inline RUN --network=fake" {
_prefetch alpine
run_buildah 125 build $WITH_POLICY_JSON -t source -f $BUDFILES/inline-network/Dockerfile3
expect_output --substring "unsupported value"
}
@ -210,18 +215,18 @@ _EOF
@test "bud with ignoresymlink on default file" {
cat > /tmp/private_file << _EOF
hello
_EOF
run_buildah build $WITH_POLICY_JSON -t test -f Dockerfile $BUDFILES/container-ignoresymlink
# Default file must not point to symlink so hello should not be ignored from build context
expect_output --substring "hello"
_prefetch alpine
echo hello > ${TEST_SCRATCH_DIR}/private_file
cp -a $BUDFILES/container-ignoresymlink ${TEST_SCRATCH_DIR}/container-ignoresymlink
ln -s ${TEST_SCRATCH_DIR}/private_file ${TEST_SCRATCH_DIR}/container-ignoresymlink/.dockerignore
run_buildah build $WITH_POLICY_JSON -t test -f Dockerfile $BUDFILES/container-ignoresymlink
# Should ignore a .dockerignore or .containerignore that's a symlink to somewhere outside of the build context
expect_output --substring "hello"
}
#Verify https://github.com/containers/buildah/issues/4342
# Verify https://github.com/containers/buildah/issues/4342
@test "buildkit-mount type=cache should not hang if cache is wiped in between" {
_prefetch alpine
containerfile=$BUDFILES/cache-mount-locked/Containerfile
run_buildah build $WITH_POLICY_JSON --build-arg WIPE_CACHE=1 -t source -f $containerfile $BUDFILES/cache-mount-locked
# build should be success and must contain `hello` from `file` in last step
@ -230,7 +235,6 @@ expect_output --substring "hello"
# Test for https://github.com/containers/buildah/pull/4295
@test "build test warning for preconfigured TARGETARCH, TARGETOS, TARGETPLATFORM or TARGETVARIANT" {
_prefetch alpine
containerfile=$BUDFILES/platform-sets-args/Containerfile
# Containerfile must contain one or more (four, as of 2022-10) lines
@ -259,7 +263,6 @@ expect_output --substring "hello"
"With explicit --os (but no arch/variant), buildah should not warn about TARGETOS"
# FIXME: add --arch test too, and maybe make this cleaner
fi
}
@test "build-conflicting-isolation-chroot-and-network" {
@ -294,6 +297,7 @@ _EOF
}
@test "bud --layers should not hit cache if heredoc is changed" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -329,6 +333,7 @@ _EOF
}
@test "bud build with heredoc content" {
_prefetch fedora
run_buildah build -t heredoc $WITH_POLICY_JSON -f $BUDFILES/heredoc/Containerfile .
expect_output --substring "print first line from heredoc"
expect_output --substring "print second line from heredoc"
@ -459,12 +464,14 @@ symlink(subdir)"
}
@test "bud with .dockerignore #2" {
_prefetch busybox
run_buildah 125 build -t testbud3 $WITH_POLICY_JSON $BUDFILES/dockerignore3
expect_output --substring 'building.*"COPY test1.txt /upload/test1.txt".*no such file or directory'
expect_output --substring $(realpath "$BUDFILES/dockerignore3/.dockerignore")
}
@test "bud with .dockerignore #4" {
_prefetch busybox
run_buildah 125 build -t testbud3 $WITH_POLICY_JSON -f Dockerfile.test $BUDFILES/dockerignore4
expect_output --substring 'building.*"COPY test1.txt /upload/test1.txt".*no such file or directory'
expect_output --substring '1 filtered out using /[^ ]*/Dockerfile.test.dockerignore'
@ -513,6 +520,7 @@ symlink(subdir)"
}
@test "build with basename resolving user arg" {
_prefetch alpine
run_buildah build --build-arg CUSTOM_TARGET=first $WITH_POLICY_JSON -t test -f $BUDFILES/base-with-arg/Containerfile2
expect_output --substring "This is built for first"
run_buildah build --build-arg CUSTOM_TARGET=second $WITH_POLICY_JSON -t test -f $BUDFILES/base-with-arg/Containerfile2
@ -520,6 +528,7 @@ symlink(subdir)"
}
@test "build with basename resolving user arg from file" {
_prefetch alpine
run_buildah build \
--build-arg-file $BUDFILES/base-with-arg/first.args \
$WITH_POLICY_JSON -t test -f $BUDFILES/base-with-arg/Containerfile2
@ -532,6 +541,7 @@ symlink(subdir)"
}
@test "build with basename resolving user arg from latest file in arg list" {
_prefetch alpine
run_buildah build \
--build-arg-file $BUDFILES/base-with-arg/second.args \
--build-arg-file $BUDFILES/base-with-arg/first.args \
@ -540,6 +550,7 @@ symlink(subdir)"
}
@test "build with basename resolving user arg from in arg list" {
_prefetch alpine
run_buildah build \
--build-arg-file $BUDFILES/base-with-arg/second.args \
--build-arg CUSTOM_TARGET=first \
@ -550,6 +561,7 @@ symlink(subdir)"
# Following test should fail since we are trying to use build-arg which
# was not declared. Honors discussion here: https://github.com/containers/buildah/pull/4061/commits/1237c04d6ae0ee1f027a1f02bf3ab5c57ac7d9b6#r906188374
@test "build with basename resolving user arg - should fail" {
_prefetch alpine
run_buildah 125 build --build-arg CUSTOM_TARGET=first $WITH_POLICY_JSON -t test -f $BUDFILES/base-with-arg/Containerfilebad
expect_output --substring "invalid reference format"
}
@ -660,6 +672,7 @@ _EOF
# Test build with --add-history=false
@test "build-with-omit-history-to-true should not add history" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -681,6 +694,7 @@ _EOF
# Test building with --userns=auto
@test "build with --userns=auto also with size" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
user=$USER
@ -712,6 +726,7 @@ _EOF
# Test building with --userns=auto with uidmapping
@test "build with --userns=auto with uidmapping" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
user=$USER
@ -737,6 +752,7 @@ _EOF
# Test building with --userns=auto with gidmapping
@test "build with --userns=auto with gidmapping" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
user=$USER
@ -763,6 +779,7 @@ _EOF
# Test bud with prestart hook
@test "build-test with OCI prestart hook" {
skip_if_in_container # This works in privileged container setup but does not works in CI setup
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir/hooks
@ -797,6 +814,7 @@ _EOF
}
@test "build with add resolving to invalid HTTP status code" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -826,6 +844,7 @@ _EOF
}
@test "build-test --mount=type=secret test relative to workdir mount" {
_prefetch alpine
local contextdir=$BUDFILES/secret-relative
run_buildah build $WITH_POLICY_JSON --no-cache --secret id=secret-foo,src=$contextdir/secret1.txt --secret id=secret-bar,src=$contextdir/secret2.txt -t test -f $contextdir/Dockerfile
expect_output --substring "secret:foo"
@ -833,6 +852,7 @@ _EOF
}
@test "build-test --mount=type=cache test relative to workdir mount" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
## write-cache
@ -857,6 +877,7 @@ _EOF
}
@test "build-test do not use mount stage from cache if it was rebuilt" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -899,6 +920,7 @@ _EOF
# Verify: https://github.com/containers/buildah/issues/4572
@test "build-test verify no dangling containers are left" {
_prefetch alpine busybox
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -932,6 +954,7 @@ _EOF
@test "build-test skipping unwanted stages with --skip-unused-stages=false and --skip-unused-stages=true" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -965,6 +988,7 @@ _EOF
}
@test "build-test: do not warn for instructions declared in unused stages" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1001,6 +1025,7 @@ _EOF
# Test skipping images with FROM
@test "build-test skipping unwanted stages with FROM" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1046,6 +1071,7 @@ _EOF
# so selected stage should be still skipped since it is not being actually used by additional build
# context is being used.
@test "build-test skipping unwanted stages with FROM and conflict with additional build context" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
# add file on original context
@ -1074,6 +1100,7 @@ _EOF
# Test skipping unwanted stage with COPY from stage name
@test "build-test skipping unwanted stages with COPY from stage name" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1100,6 +1127,7 @@ _EOF
}
@test "build test --retry and --retry-delay" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1115,6 +1143,7 @@ _EOF
# Test skipping unwanted stage with COPY from stage index
@test "build-test skipping unwanted stages with COPY from stage index" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1145,6 +1174,7 @@ _EOF
# Test if our cache is working in optimal way for COPY use case
@test "build test optimal cache working for COPY instruction" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1162,6 +1192,7 @@ _EOF
# Test if our cache is working in optimal way for ADD use case
@test "build test optimal cache working for ADD instruction" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1179,6 +1210,7 @@ _EOF
# Test skipping unwanted stage with --mount from another stage
@test "build-test skipping unwanted stages with --mount from stagename" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1208,6 +1240,7 @@ _EOF
# Test skipping unwanted stage with --mount from another stage
@test "build-test skipping unwanted stages with --mount from stagename with flag order changed" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1237,6 +1270,7 @@ _EOF
# Test pinning image using additional build context
@test "build-with-additional-build-context and COPY, test pinning image" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1262,6 +1296,7 @@ _EOF
# Test conflict between stage short name and additional-context conflict
# Buildkit parity give priority to additional-context over stage names.
@test "build-with-additional-build-context and COPY, stagename and additional-context conflict" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1290,6 +1325,7 @@ _EOF
# When numeric index of stage is used and stage exists but additional context also exist with name
# same as stage in such situations always use additional context.
@test "build-with-additional-build-context and COPY, additionalContext and numeric value of stage" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1319,6 +1355,7 @@ _EOF
# Test conflict between stage short name and additional-context conflict on FROM
# Buildkit parity give priority to additional-context over stage names.
@test "build-with-additional-build-context and FROM, stagename and additional-context conflict" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1346,6 +1383,7 @@ _EOF
# Test adding additional build context
@test "build-with-additional-build-context and COPY, additional context from host" {
_prefetch alpine
local contextdir1=${TEST_SCRATCH_DIR}/bud/platform
local contextdir2=${TEST_SCRATCH_DIR}/bud/platform2
mkdir -p $contextdir1 $contextdir2
@ -1371,6 +1409,7 @@ _EOF
# Test adding additional build context but download tar
@test "build-with-additional-build-context and COPY, additional context from external URL" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1388,6 +1427,7 @@ _EOF
# Test pinning image
@test "build-with-additional-build-context and FROM, pin busybox to alpine" {
_prefetch busybox
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1405,6 +1445,7 @@ _EOF
# Test usage of RUN --mount=from=<name> with additional context and also test conflict with stage-name
@test "build-with-additional-build-context and RUN --mount=from=, additional-context and also test conflict with stagename" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1432,6 +1473,7 @@ _EOF
# Test usage of RUN --mount=from=<name> with additional context and also test conflict with stage-name, when additionalContext is on host
@test "build-with-additional-build-context and RUN --mount=from=, additional-context not image and also test conflict with stagename" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
echo world > $contextdir/hello
@ -1452,6 +1494,7 @@ _EOF
# Test usage of RUN --mount=from=<name> with additional context is URL and mount source is relative using src
@test "build-with-additional-build-context and RUN --mount=from=, additional-context is URL and mounted from subdir" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -1470,6 +1513,7 @@ _EOF
}
@test "build-with-additional-build-context and COPY, ensure .containerignore is being respected" {
_prefetch alpine
local additionalcontextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $additionalcontextdir
touch $additionalcontextdir/hello
@ -1493,6 +1537,7 @@ _EOF
}
@test "bud with --layers and --no-cache flags" {
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/use-layers
cp -a $BUDFILES/use-layers $contextdir
@ -1794,6 +1839,7 @@ _EOF
}
@test "bud with --layers and --build-args: use raw ARG and cache should not be used" {
_prefetch alpine
# when ARG is used as a raw value
run_buildah build $WITH_POLICY_JSON --build-arg=FOO=1 --layers -t args-cache -f $BUDFILES/with-arg/Dockerfile2
run_buildah inspect -f '{{.FromImageID}}' args-cache
@ -2370,6 +2416,7 @@ _EOF
run_buildah rm ${cid}
run_buildah rmi -a
_prefetch alpine
target=multi-stage-mixed
run_buildah build $WITH_POLICY_JSON -t ${target} -f $BUDFILES/multi-stage-builds-small-as/Dockerfile.mixed $BUDFILES/multi-stage-builds-small-as
run_buildah from --quiet ${target}
@ -3557,8 +3604,6 @@ _EOF
@test "bud-multi-stage-nocache-nocommit" {
_prefetch alpine
# pull the base image directly, so that we don't record it being written to local storage in the next step
run_buildah pull $WITH_POLICY_JSON alpine
# okay, build an image with two stages
run_buildah --log-level=debug bud $WITH_POLICY_JSON -f $BUDFILES/multi-stage-builds/Dockerfile.name $BUDFILES/multi-stage-builds
# debug messages should only record us creating one new image: the one for the second stage, since we don't base anything on the first
@ -3949,6 +3994,7 @@ _EOF
}
@test "bud with specified context should succeed if context contains existing Dockerfile" {
_prefetch alpine
echo "FROM alpine" > $TEST_SCRATCH_DIR/Dockerfile
run_buildah bud $WITH_POLICY_JSON $TEST_SCRATCH_DIR/Dockerfile
}
@ -4004,6 +4050,7 @@ _EOF
# Following test must pass for both rootless and rootfull
@test "rootless: support --device and renaming device using bind-mount" {
_prefetch alpine
skip_if_in_container # unable to perform mount of /dev/null for test in CI container setup
local contextdir=${TEST_SCRATCH_DIR}/bud/platform
mkdir -p $contextdir
@ -4451,12 +4498,14 @@ EOM
}
@test "bud arg and env var with same name" {
_prefetch centos:8
# Regression test for https://github.com/containers/buildah/issues/2345
run_buildah build $WITH_POLICY_JSON -t testctr $BUDFILES/dupe-arg-env-name
expect_output --substring "https://example.org/bar"
}
@test "bud copy chown with newuser" {
_prefetch ubuntu:latest
# Regression test for https://github.com/containers/buildah/issues/2192
run_buildah build $WITH_POLICY_JSON -t testctr -f $BUDFILES/copy-chown/Containerfile.chown_user $BUDFILES/copy-chown
expect_output --substring "myuser myuser"
@ -4479,8 +4528,7 @@ EOM
skip_if_no_runtime
${OCI} --version
_prefetch alpine
_prefetch busybox
_prefetch alpine busybox
run_buildah build --build-arg base=alpine --build-arg toolchainname=busybox --build-arg destinationpath=/tmp --pull=false $WITH_POLICY_JSON -f $BUDFILES/from-with-arg/Containerfile .
expect_output --substring "FROM alpine"
@ -4629,6 +4677,8 @@ EOF
}
@test "bud cache by format" {
_prefetch alpine
# Build first in Docker format. Whether we do OCI or Docker first shouldn't matter, so we picked one.
run_buildah build --iidfile ${TEST_SCRATCH_DIR}/first-docker --format docker --layers --quiet $WITH_POLICY_JSON $BUDFILES/cache-format
@ -4695,6 +4745,7 @@ EOF
}
@test "bud-terminal" {
_prefetch busybox
run_buildah build $BUDFILES/terminal
}
@ -5871,6 +5922,7 @@ _EOF
}
@test "bud with containerfile env secret" {
_prefetch alpine
export MYSECRET=SOMESECRETDATA
run_buildah build --secret=id=mysecret,src=MYSECRET,type=env $WITH_POLICY_JSON -t secretimg -f $BUDFILES/run-mounts/Dockerfile.secret $BUDFILES/run-mounts
expect_output --substring "SOMESECRETDATA"
@ -6102,6 +6154,7 @@ _EOF
@test "bud with run should not leave mounts behind cleanup test" {
skip_if_in_container
skip_if_no_podman
_prefetch alpine
# Create target dir where we will export tar
target=cleanable
@ -6126,6 +6179,7 @@ _EOF
@test "bud with custom files in /run/ should persist cleanup test" {
skip_if_in_container
skip_if_no_podman
_prefetch alpine
# Create target dir where we will export tar
target=cleanable
@ -6150,6 +6204,7 @@ _EOF
@test "bud-with-mount-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=$BUDFILES/buildkit-mount
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfile $contextdir/
expect_output --substring "hello"
@ -6159,6 +6214,7 @@ _EOF
@test "bud-with-mount-no-source-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfile2 $contextdir/
@ -6169,6 +6225,7 @@ _EOF
@test "bud-with-mount-with-only-target-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfile6 $contextdir/
@ -6178,6 +6235,7 @@ _EOF
@test "bud-with-mount-no-subdir-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfile $contextdir/subdir/
@ -6188,6 +6246,7 @@ _EOF
@test "bud-with-mount-relative-path-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfile4 $contextdir/
@ -6198,6 +6257,7 @@ _EOF
@test "bud-with-mount-with-rw-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build --isolation chroot -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfile3 $contextdir/subdir/
@ -6208,6 +6268,7 @@ _EOF
@test "bud-verify-if-we-dont-clean-prexisting-path" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine debian
run_buildah 1 build -t testbud $WITH_POLICY_JSON --secret id=secret-foo,src=$BUDFILES/verify-cleanup/secret1.txt -f $BUDFILES/verify-cleanup/Dockerfile $BUDFILES/verify-cleanup/
expect_output --substring "hello"
expect_output --substring "secrettext"
@ -6222,6 +6283,7 @@ _EOF
@test "bud-with-mount-with-tmpfs-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
# tmpfs mount: target should be available on container without creating any special directory on container
@ -6232,6 +6294,7 @@ _EOF
@test "bud-with-mount-with-tmpfs-with-copyup-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfiletmpfscopyup
@ -6242,6 +6305,7 @@ _EOF
@test "bud-with-mount-cache-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
# try writing something to persistent cache
@ -6256,6 +6320,7 @@ _EOF
@test "bud-with-mount-cache-like-buildkit with buildah prune should clear the cache" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
# try writing something to persistent cache
@ -6286,6 +6351,7 @@ _EOF
# Note: this test is just testing syntax for sharing, actual behaviour test needs parallel build in order to test locking.
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
# try writing something to persistent cache
@ -6297,6 +6363,7 @@ _EOF
@test "bud-with-multiple-mount-keeps-default-bind-mount" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount
cp -R $BUDFILES/buildkit-mount $contextdir
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfilemultiplemounts $contextdir/
@ -6332,6 +6399,7 @@ _EOF
@test "bud-with-mount-bind-from-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# build base image which we will use as our `from`
@ -6346,6 +6414,7 @@ _EOF
@test "bud-with-writeable-mount-bind-from-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# build base image which we will use as our `from`
@ -6360,6 +6429,7 @@ _EOF
@test "bud-with-mount-bind-from-without-source-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# build base image which we will use as our `from`
@ -6374,6 +6444,7 @@ _EOF
@test "bud-with-mount-bind-from-with-empty-from-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# build base image which we will use as our `from`
@ -6387,6 +6458,7 @@ _EOF
@test "bud-with-mount-cache-from-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# try reading something from persistent cache in a different build
@ -6399,6 +6471,7 @@ _EOF
@test "bud-with-mount-cache-image-from-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
@ -6414,6 +6487,7 @@ _EOF
@test "bud-with-mount-cache-multiple-from-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# try reading something from persistent cache in a different build
@ -6426,6 +6500,7 @@ _EOF
@test "bud-with-mount-bind-from-relative-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# build base image which we will use as our `from`
@ -6442,6 +6517,7 @@ _EOF
cp -R $BUDFILES/buildkit-mount-from $contextdir
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
# build base image which we will use as our `from`
run_buildah build -t testbud $WITH_POLICY_JSON -f $contextdir/Dockerfilemultistagefrom $contextdir/
expect_output --substring "hello"
@ -6451,6 +6527,7 @@ _EOF
@test "bud-with-mount-bind-from-cache-multistage-relative-like-buildkit" {
skip_if_no_runtime
skip_if_in_container
_prefetch alpine
local contextdir=${TEST_SCRATCH_DIR}/buildkit-mount-from
cp -R $BUDFILES/buildkit-mount-from $contextdir
# build base image which we will use as our `from`

View File

@ -1,4 +1,4 @@
FROM quay.io/centos/centos:8
FROM alpine
ARG WIPE_CACHE

View File

@ -146,7 +146,6 @@ _EOF
retry=10
retry_delay="5s"
EOF
_prefetch alpine
CONTAINERS_CONF=${TEST_SCRATCH_DIR}/containers.conf run_buildah build --help
expect_output --substring "retry.*\(default 10\)"
expect_output --substring "retry-delay.*\(default \"5s\"\)"

View File

@ -20,7 +20,7 @@ load helpers
}
@test "from-with-digest" {
run_buildah pull alpine
_prefetch alpine
run_buildah inspect --format "{{.FromImageID}}" alpine
digest=$output

View File

@ -9,6 +9,7 @@ load helpers
skip "skipping overlay test because \$STORAGE_DRIVER = $STORAGE_DRIVER"
fi
image=alpine
_prefetch $image
mkdir ${TEST_SCRATCH_DIR}/lower
touch ${TEST_SCRATCH_DIR}/lower/foo
@ -38,6 +39,7 @@ load helpers
skip "skipping overlay test because \$STORAGE_DRIVER = $STORAGE_DRIVER"
fi
image=alpine
_prefetch $image
mkdir -m 770 ${TEST_SCRATCH_DIR}/lower
chown 1:1 ${TEST_SCRATCH_DIR}/lower
permission=$(stat -c "%a %u %g" ${TEST_SCRATCH_DIR}/lower)
@ -68,6 +70,7 @@ load helpers
skip "skipping overlay test because \$STORAGE_DRIVER = $STORAGE_DRIVER"
fi
image=alpine
_prefetch $image
mkdir ${TEST_SCRATCH_DIR}/a:lower
touch ${TEST_SCRATCH_DIR}/a:lower/foo

View File

@ -554,6 +554,7 @@ function configure_and_check_user() {
@test "run-builtin-volume-omitted" {
# This image is known to include a volume, but not include the mountpoint
# in the image.
_prefetch quay.io/libpod/registry:volume_omitted
run_buildah from --quiet --pull=ifmissing $WITH_POLICY_JSON quay.io/libpod/registry:volume_omitted
cid=$output
run_buildah mount $cid
@ -807,6 +808,7 @@ $output"
@test "run --network=none and --isolation chroot must conflict" {
skip_if_no_runtime
_prefetch alpine
run_buildah from --quiet --pull=ifmissing $WITH_POLICY_JSON alpine
cid=$output
# should fail by default
@ -817,6 +819,7 @@ $output"
@test "run --network=private must mount a fresh /sys" {
skip_if_no_runtime
_prefetch alpine
run_buildah from --quiet --pull=ifmissing $WITH_POLICY_JSON alpine
cid=$output
# verify there is no /sys/kernel/security in the container, that would mean /sys
@ -827,6 +830,7 @@ $output"
@test "run --network should override build --network" {
skip_if_no_runtime
_prefetch alpine
run_buildah from --network=none --quiet --pull=ifmissing $WITH_POLICY_JSON alpine
cid=$output
# should fail by default