mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-12 09:24:23 +00:00
fix: avoid passing empty variable names
This commit is contained in:
@@ -130,7 +130,11 @@ func (c *ContainerFilter) getArgs() []string {
|
|||||||
|
|
||||||
// export the local environment vars to the container
|
// export the local environment vars to the container
|
||||||
for _, pair := range os.Environ() {
|
for _, pair := range os.Environ() {
|
||||||
args = append(args, "-e", strings.Split(pair, "=")[0])
|
tokens := strings.Split(pair, "=")
|
||||||
|
if tokens[0] == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
args = append(args, "-e", tokens[0])
|
||||||
}
|
}
|
||||||
return append(args, c.Image)
|
return append(args, c.Image)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,7 +131,11 @@ metadata:
|
|||||||
}
|
}
|
||||||
for _, e := range os.Environ() {
|
for _, e := range os.Environ() {
|
||||||
// the process env
|
// the process env
|
||||||
expected = append(expected, "-e", strings.Split(e, "=")[0])
|
tokens := strings.Split(e, "=")
|
||||||
|
if tokens[0] == "" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
expected = append(expected, "-e", tokens[0])
|
||||||
}
|
}
|
||||||
expected = append(expected, "example.com:version")
|
expected = append(expected, "example.com:version")
|
||||||
assert.Equal(t, expected, cmd.Args)
|
assert.Equal(t, expected, cmd.Args)
|
||||||
|
|||||||
Reference in New Issue
Block a user