aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-17 12:54:36 +0200
committerGitHub <noreply@github.com>2022-09-17 12:54:36 +0200
commit4e14fa05c9e6ce2ad927e953057294ae05748b37 (patch)
treeea8b5343ad52395e6d653abd382df5640c00446e
parent8f76bc2d739657cf4394cb4d08f314011ba08dab (diff)
parent049b1088456cb34a3f3b012e3d228ca154a796c5 (diff)
downloadpodman-4e14fa05c9e6ce2ad927e953057294ae05748b37.tar.gz
podman-4e14fa05c9e6ce2ad927e953057294ae05748b37.tar.bz2
podman-4e14fa05c9e6ce2ad927e953057294ae05748b37.zip
Merge pull request #15839 from cdoern/clone
podman container clone env patch
-rw-r--r--pkg/specgen/generate/container.go2
-rw-r--r--test/e2e/container_clone_test.go13
2 files changed, 14 insertions, 1 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go
index c18b5654a..736fa5ab3 100644
--- a/pkg/specgen/generate/container.go
+++ b/pkg/specgen/generate/container.go
@@ -352,7 +352,7 @@ func ConfigToSpec(rt *libpod.Runtime, specg *specgen.SpecGenerator, contaierID s
if conf.Spec.Process != nil && conf.Spec.Process.Env != nil {
env := make(map[string]string)
for _, entry := range conf.Spec.Process.Env {
- split := strings.Split(entry, "=")
+ split := strings.SplitN(entry, "=", 2)
if len(split) == 2 {
env[split[0]] = split[1]
}
diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go
index 1ba5de1a3..29ef3bc2a 100644
--- a/test/e2e/container_clone_test.go
+++ b/test/e2e/container_clone_test.go
@@ -308,5 +308,18 @@ var _ = Describe("Podman container clone", func() {
Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("123"))
+ session = podmanTest.Podman([]string{"run", "--name", "env_ctr2", "-e", "ENV_TEST=12=3", ALPINE, "printenv", "ENV_TEST"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"container", "clone", "env_ctr2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ session = podmanTest.Podman([]string{"start", "-a", "env_ctr2-clone"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).Should(ContainSubstring("12=3"))
+
})
})