diff options
author | Aditya R <arajan@redhat.com> | 2022-03-02 15:07:06 +0530 |
---|---|---|
committer | Aditya R <arajan@redhat.com> | 2022-03-02 19:02:33 +0530 |
commit | 0bd0ad59436436e93ac81ce46059d8618ed7766c (patch) | |
tree | ed3c97ca2cb90b11b557b4db9dcab97ee2e623c6 /test/e2e/build_test.go | |
parent | 7877b02aacf3e8d3d37f6283c6b8aa81688fd120 (diff) | |
download | podman-0bd0ad59436436e93ac81ce46059d8618ed7766c.tar.gz podman-0bd0ad59436436e93ac81ce46059d8618ed7766c.tar.bz2 podman-0bd0ad59436436e93ac81ce46059d8618ed7766c.zip |
container: workdir resolution must consider symlink if explicitly configured
While resolving `workdir` we mostly create a `workdir` when `stat`
fails with `ENOENT` or `ErrNotExist` however following cases are not
true when user explicitly specifies a `workdir` while `running` using
`--workdir` which tells `podman` to only use workdir if its exists on
the container. Following configuration is implicity set with other
`run` mechanism like `podman play kube`
Problem with explicit `--workdir` or similar implicit config in `podman play
kube` is that currently podman ignores the fact that workdir can also be
a `symlink` and actual `link` could be valid.
Hence following commit ensures that in such scenarios when a `workdir`
is not found and we cannot create a `workdir` podman must perform a
check to ensure that if `workdir` is a `symlink` and `link` is resolved
successfully and resolved link is present on the container then we
return as it is.
Docker performs a similar behviour.
Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'test/e2e/build_test.go')
-rw-r--r-- | test/e2e/build_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/e2e/build_test.go b/test/e2e/build_test.go index a1c2f5e54..14fa12fa2 100644 --- a/test/e2e/build_test.go +++ b/test/e2e/build_test.go @@ -259,6 +259,19 @@ var _ = Describe("Podman build", func() { Expect(session.OutputToString()).NotTo(ContainSubstring("io.podman.annotations.seccomp")) }) + It("podman build where workdir is a symlink and run without creating new workdir", func() { + session := podmanTest.Podman([]string{ + "build", "-f", "build/workdir-symlink/Dockerfile", "-t", "test-symlink", + }) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + session = podmanTest.Podman([]string{"run", "--workdir", "/tmp/link", "test-symlink"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + Expect(session.OutputToString()).To(ContainSubstring("hello")) + }) + It("podman build --http_proxy flag", func() { os.Setenv("http_proxy", "1.2.3.4") if IsRemote() { |