Environment variables with multiple '=' are not parsed correctly (#278)

* Provide failing test for an env variable with multiple '='

* Environment variables are split only in two parts
This commit is contained in:
Andrea Giardini 2018-08-07 19:22:48 +02:00 committed by priyawadhwa
parent 2261adca68
commit c44c317b00
2 changed files with 2 additions and 1 deletions

View File

@ -1,6 +1,7 @@
FROM gcr.io/google-appengine/debian9@sha256:1d6a9a6d106bd795098f60f4abb7083626354fa6735e81743c7f8cfca11259f0
ENV hey hey
ENV PATH /usr/local
ENV testmultipleeq="this=is a=test string=with a=lot of=equals"
ENV hey hello
ENV first=foo second=foo2
ENV third $second:/third

View File

@ -245,7 +245,7 @@ func UpdateConfigEnv(newEnvs []instructions.KeyValuePair, config *v1.Config, rep
// First, convert config.Env array to []instruction.KeyValuePair
var kvps []instructions.KeyValuePair
for _, env := range config.Env {
entry := strings.Split(env, "=")
entry := strings.SplitN(env, "=", 2)
kvps = append(kvps, instructions.KeyValuePair{
Key: entry[0],
Value: entry[1],