From 2c500a8145854c5f566bf76199d2a27226925b60 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Tue, 2 Mar 2021 14:57:46 -0500 Subject: Add support for podman build --ignorefile Fixes: https://github.com/containers/podman/issues/9570 Signed-off-by: Daniel J Walsh --- test/system/070-build.bats | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'test') diff --git a/test/system/070-build.bats b/test/system/070-build.bats index 1e7d366a1..a9f97d5ab 100644 --- a/test/system/070-build.bats +++ b/test/system/070-build.bats @@ -362,6 +362,82 @@ Labels.$label_name | $label_value run_podman rmi -f build_test } +@test "podman build - COPY with ignore" { + local tmpdir=$PODMAN_TMPDIR/build-test-$(random_string 10) + mkdir -p $tmpdir/subdir + + # Create a bunch of files. Declare this as an array to avoid duplication + # because we iterate over that list below, checking for each file. + # A leading "-" indicates that the file SHOULD NOT exist in the built image + local -a files=( + -test1 -test1.txt + test2 test2.txt + subdir/sub1 subdir/sub1.txt + -subdir/sub2 -subdir/sub2.txt + this-file-does-not-match-anything-in-ignore-file + comment + ) + for f in ${files[@]}; do + # The magic '##-' strips off the '-' prefix + echo "$f" > $tmpdir/${f##-} + done + + # Directory that doesn't exist in the image; COPY should create it + local newdir=/newdir-$(random_string 12) + cat >$tmpdir/Containerfile <$tmpdir/$ignorefile <