summaryrefslogtreecommitdiff
path: root/test/system
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-07-09 07:50:28 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2021-07-10 06:47:59 -0400
commit48ff2ef5a36df054a6aaf30ee34574ee1ec0b6d7 (patch)
treef53ca59f233bf4dcd3010b0886038e598060e147 /test/system
parentbef1f03d3ca8bfd90f4cbb295d99bf97df74a815 (diff)
downloadpodman-48ff2ef5a36df054a6aaf30ee34574ee1ec0b6d7.tar.gz
podman-48ff2ef5a36df054a6aaf30ee34574ee1ec0b6d7.tar.bz2
podman-48ff2ef5a36df054a6aaf30ee34574ee1ec0b6d7.zip
Don't exclude Dockerfile, Containerfiles from tar content
If the user specifies "*" in a .dockerignore or a .containerignore then podman-remote build should not exclude the Dockerfile or Containerfile or any content pointed to by `-f` in the context directory. We still need these files on the server side to complete the build. Fixes: https://github.com/containers/podman/issues/9867 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test/system')
-rw-r--r--test/system/070-build.bats34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index c45a661fe..7046625c6 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -509,6 +509,40 @@ EOF
done
}
+# Regression test for #9867
+# Make sure that if you exclude everything in context dir, that
+# the Containerfile/Dockerfile in the context dir are used
+@test "podman build with ignore '*'" {
+ local tmpdir=$PODMAN_TMPDIR/build-test-$(random_string 10)
+ mkdir -p $tmpdir
+
+ cat >$tmpdir/Containerfile <<EOF
+FROM scratch
+EOF
+
+cat >$tmpdir/.dockerignore <<EOF
+*
+EOF
+
+ run_podman build -t build_test $tmpdir
+
+ # Rename Containerfile to Dockerfile
+ mv $tmpdir/Containerfile $tmpdir/Dockerfile
+
+ run_podman build -t build_test $tmpdir
+
+ # Rename Dockerfile to foofile
+ mv $tmpdir/Dockerfile $tmpdir/foofile
+
+ run_podman 125 build -t build_test $tmpdir
+ is "$output" ".*Dockerfile: no such file or directory"
+
+ run_podman build -t build_test -f $tmpdir/foofile $tmpdir
+
+ # Clean up
+ run_podman rmi -f build_test
+}
+
@test "podman build - stdin test" {
# Random workdir, and random string to verify build output
workdir=/$(random_string 10)