Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containerignore, remote, Containerfile, broken #17059

Closed
edsantiago opened this issue Jan 10, 2023 · 6 comments
Closed

containerignore, remote, Containerfile, broken #17059

edsantiago opened this issue Jan 10, 2023 · 6 comments
Assignees
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@edsantiago
Copy link
Member

edsantiago commented Jan 10, 2023

#16810 broke #13665. "Containerfile" used to appear in output, it no longer does. But because the test was broken, and nobody tried to fix it, we didn't notice.

Reproducer (save this as test-13655)

#!/bin/bash

rm -rf /tmp/pm1 /tmp/pm2

mkdir /tmp/pm1 /tmp/pm2
cat >/tmp/pm1/Containerfile <<EOF
FROM alpine
ADD . /testfilter/
RUN find /testfilter/ -print
EOF

# With no files in context dir, error "While reading directory /tmp/pm2: EOF"
touch /tmp/pm2/dummyfile

bin/podman rmi -f foo
bin/podman-remote build -t foo -f /tmp/pm1/Containerfile /tmp/pm2 |& tee /tmp/pm1/log

echo
if grep /Containerfile /tmp/pm1/log; then
    echo "GOOD"
else
    echo "BAD"
    exit 1
fi

Steps:

$ git co 553df8748bd7936ba09c836d54525e45d80c121e^
$ ./test-13655 
GOOD
$ git co 553df8748bd7936ba09c836d54525e45d80c121e
$ ./test-13655
BAD

@flouthoc PTAL.

And when this gets re-fixed, please (fingers crossed) try this to see if it fixes the test:

diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go
index fb75ad1b9..8e3f3647c 100644
--- a/test/e2e/build_test.go
+++ b/test/e2e/build_test.go
@@ -572,8 +572,6 @@ subdir**`
        // See https://github.com/containers/podman/issues/13535
        It("Remote build .containerignore filtering embedded directory (#13535)", func() {
                SkipIfNotRemote("Testing remote .containerignore file filtering")
-               Skip("FIXME: #15014: test times out in 'dd' on f36.")
-
                podmanTest.RestartRemoteService()
 
                // Switch to temp dir and restore it afterwards
@@ -605,7 +603,7 @@ subdir**`
                dd := exec.Command("dd", "if=/dev/urandom", "of="+randomFile, "bs=1G", "count=1")
                ddSession, err := Start(dd, GinkgoWriter, GinkgoWriter)
                Expect(err).ToNot(HaveOccurred())
-               Eventually(ddSession, "10s", "1s").Should(Exit(0))
+               Eventually(ddSession, "30s", "1s").Should(Exit(0))
 
                // make cwd as context root path
                Expect(os.Chdir(contextDir)).ToNot(HaveOccurred())
@edsantiago edsantiago added the remote Problem is in podman-remote label Jan 10, 2023
@github-actions github-actions bot removed the remote Problem is in podman-remote label Jan 10, 2023
@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2023

@flouthoc PTAL

@flouthoc
Copy link
Collaborator

@edsantiago I wonder why is Containerfile is expected in the text if context was empty, this was the exact issue which was fixed here #16810 but I will verify once again with docker compat.

@edsantiago
Copy link
Member Author

@flouthoc many pardons, I mistyped the original PR. Please see #13665 for the reason(s) that Containerfile is sent

@edsantiago
Copy link
Member Author

@flouthoc ping

@flouthoc
Copy link
Collaborator

@edsantiago Thanks for the reminder I'll take this.

@flouthoc
Copy link
Collaborator

Hi @edsantiago , I verified this whole scenario against docker and buildkit I think the new podman is working correctly and we might wanna retrofit the older test case.

Test with legacy docker

#!/bin/bash

rm -rf /tmp/pm1 /tmp/pm2

mkdir /tmp/pm1 /tmp/pm2
cat >/tmp/pm1/Containerfile <<EOF
FROM alpine
ADD . /testfilter/
RUN find /testfilter/ -print
EOF

# With no files in context dir, error "While reading directory /tmp/pm2: EOF"
touch /tmp/pm2/dummyfile

sudo docker rmi -f foo
sudo docker build -t foo -f /tmp/pm1/Containerfile /tmp/pm2 |& tee /tmp/pm1/log

echo
if grep /Containerfile /tmp/pm1/log; then
    echo "GOOD"
else
    echo "BAD"
    exit 1
fi
Output
[fl@fedora docker-exp]$ sudo ./test.sh 
Untagged: foo:latest
Deleted: sha256:bb1c15b9a7a1ff4486962b806c987965d48d90688e8ac5dfad4658a881ed0a6b
Sending build context to Docker daemon  2.095kB
Step 1/3 : FROM alpine
 ---> e66264b98777
Step 2/3 : ADD . /testfilter/
 ---> 05c2dae93ac7
Step 3/3 : RUN find /testfilter/ -print
 ---> Running in 21289bb11ebb
/testfilter/
/testfilter/dummyfile
Removing intermediate container 21289bb11ebb
 ---> 4359167dfa89
Successfully built 4359167dfa89
Successfully tagged foo:latest

BAD

Test with buildkit

#!/bin/bash

rm -rf /tmp/pm1 /tmp/pm2

mkdir /tmp/pm1 /tmp/pm2
cat >/tmp/pm1/Containerfile <<EOF
FROM alpine
ADD . /testfilter/
RUN find /testfilter/ -print
EOF

# With no files in context dir, error "While reading directory /tmp/pm2: EOF"
touch /tmp/pm2/dummyfile

sudo docker rmi -f foo
sudo docker buildx build -t foo -f /tmp/pm1/Containerfile /tmp/pm2 |& tee /tmp/pm1/log

echo
if grep /Containerfile /tmp/pm1/log; then
    echo "GOOD"
else
    echo "BAD"
    exit 1
fi
[fl@fedora docker-exp]$ sudo ./test.sh 
[sudo] password for fl: 
Untagged: foo:latest
Deleted: sha256:4359167dfa89c5d95c48aee1cccbade238ad455650229b59a19e76f550562ed6
Deleted: sha256:05c2dae93ac722f55409acda25e153664e91a0de5af4cab491ed54e563a00d37
Deleted: sha256:cb71464a5c0c34e3d2cc152be9ada39662dfbe3fea23a5cc26e65c71f2b432e8
#1 [internal] load build definition from Containerfile
#1 transferring dockerfile: 158B done
#1 DONE 0.1s

#2 [internal] load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/alpine:latest
#3 DONE 0.0s

#4 [1/3] FROM docker.io/library/alpine
#4 DONE 0.0s

#5 [internal] load build context
#5 transferring context: 88B done
#5 DONE 0.1s

#6 [2/3] ADD . /testfilter/
#6 CACHED

#7 [3/3] RUN find /testfilter/ -print
#7 CACHED

#8 exporting to image
#8 exporting layers done
#8 writing image sha256:bb1c15b9a7a1ff4486962b806c987965d48d90688e8ac5dfad4658a881ed0a6b done
#8 naming to docker.io/library/foo done
#8 DONE 0.0s

BAD

edsantiago added a commit to edsantiago/libpod that referenced this issue Jan 19, 2023
July 2022: test was flaking on new VM images. We needed new
images, so I filed containers#15014 and skipped the test.

January 2023: no attention from anyone, so I'll try bumping up
a dd timeout from 10s to 30s. But in the interim, the test
has broken: it used to expect "Containerfile" in output (this
was deliberately added in containers#13655)... but containers#16810 changed that
so Containerfile no longer appears. @flouthoc argues that
this too is deliberate (containers#17059). Okay, so let's change the
test then. All I care about is not adding more regressions.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@edsantiago edsantiago closed this as not planned Won't fix, can't repro, duplicate, stale Jan 19, 2023
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 4, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

3 participants