summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-08-24 11:22:33 +0530
committerAditya R <arajan@redhat.com>2022-08-24 14:06:25 +0530
commitb4584ea8546be227c74174130ec3a04a93996d28 (patch)
treea18b2250fbbbc64f297415df7e27b37c2e659352 /test/e2e
parent2538bea8da2a4dba96f1c80594a66f6319d2d872 (diff)
downloadpodman-b4584ea8546be227c74174130ec3a04a93996d28.tar.gz
podman-b4584ea8546be227c74174130ec3a04a93996d28.tar.bz2
podman-b4584ea8546be227c74174130ec3a04a93996d28.zip
run,create: add support for --env-merge for preprocessing vars
Allow end users to preprocess default environment variables before injecting them into container using `--env-merge` Usage ``` podman run -it --rm --env-merge some=${some}-edit --env-merge some2=${some2}-edit2 myimage sh ``` Closes: https://github.com/containers/podman/issues/15288 Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/run_env_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/e2e/run_env_test.go b/test/e2e/run_env_test.go
index bab52efc5..9e78e150a 100644
--- a/test/e2e/run_env_test.go
+++ b/test/e2e/run_env_test.go
@@ -82,6 +82,17 @@ var _ = Describe("Podman run", func() {
Expect(session.OutputToString()).To(ContainSubstring("HOSTNAME"))
})
+ It("podman run with --env-merge", func() {
+ dockerfile := `FROM quay.io/libpod/alpine:latest
+ENV hello=world
+`
+ podmanTest.BuildImage(dockerfile, "test", "false")
+ session := podmanTest.Podman([]string{"run", "--rm", "--env-merge", "hello=${hello}-earth", "test", "env"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(ContainSubstring("world-earth"))
+ })
+
It("podman run --env-host environment test", func() {
env := append(os.Environ(), "FOO=BAR")
session := podmanTest.PodmanAsUser([]string{"run", "--rm", "--env-host", ALPINE, "/bin/printenv", "FOO"}, 0, 0, "", env)