summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorDan Duvall <dduvall@wikimedia.org>2017-06-22 14:27:37 -0700
committerDan Duvall <dduvall@wikimedia.org>2017-06-26 13:43:47 -0700
commit9f2ef14ba62f26ded606260891a648c294b50d4b (patch)
treeb74ba8eacc218047dc88c76299e3f477b88e1485 /docker
parent77b95b1f94de7cc6c1e28c0fdf2b4ecab93dd91a (diff)
downloadblubber-9f2ef14ba62f26ded606260891a648c294b50d4b.tar.gz
Support environment variables
Summary: Added support for definition of environment variables under `runs.environment`. Corresponding `ENV` instructions will be added to Dockerfile output for the unprivileged build phase. Fixes T168425 Test Plan: Run `go test ./...`. Reviewers: thcipriani, mobrovac, hashar, Jrbranaa, mmodell, #release-engineering-team Reviewed By: mobrovac Tags: #release-engineering-team Maniphest Tasks: T168425 Differential Revision: https://phabricator.wikimedia.org/D691
Diffstat (limited to 'docker')
-rw-r--r--docker/compiler.go2
-rw-r--r--docker/compiler_test.go26
2 files changed, 13 insertions, 15 deletions
diff --git a/docker/compiler.go b/docker/compiler.go
index f398164..7f030cf 100644
--- a/docker/compiler.go
+++ b/docker/compiler.go
@@ -97,7 +97,7 @@ func CompileInstruction(buffer *bytes.Buffer, instruction build.Instruction) {
case build.Copy:
Writeln(buffer, "COPY [\"", instruction.Arguments[0], "\", \"", instruction.Arguments[1], "\"]")
case build.Env:
- Writeln(buffer, "ENV ", strings.Join(instruction.Arguments, " "))
+ Writeln(buffer, "ENV ", strings.Join(instruction.Arguments, " \\\n "))
}
}
diff --git a/docker/compiler_test.go b/docker/compiler_test.go
index 7f6ee87..0b2d907 100644
--- a/docker/compiler_test.go
+++ b/docker/compiler_test.go
@@ -12,10 +12,9 @@ import (
func TestSingleStageHasNoName(t *testing.T) {
cfg, err := config.ReadConfig([]byte(`---
-base: foo/bar
-variants:
- development: {}
-`))
+ base: foo/bar
+ variants:
+ development: {}`))
assert.Nil(t, err)
@@ -26,15 +25,14 @@ variants:
func TestMultiStageIncludesStageNames(t *testing.T) {
cfg, err := config.ReadConfig([]byte(`---
-base: foo/bar
-variants:
- build: {}
- production:
- artifacts:
- - from: build
- source: .
- destination: .
-`))
+ base: foo/bar
+ variants:
+ build: {}
+ production:
+ artifacts:
+ - from: build
+ source: .
+ destination: .`))
assert.Nil(t, err)
@@ -59,5 +57,5 @@ func TestCompileInstructionEnv(t *testing.T) {
docker.CompileInstruction(buffer, instruction)
- assert.Equal(t, "ENV foo=bar baz=qux\n", buffer.String())
+ assert.Equal(t, "ENV foo=bar \\\n baz=qux\n", buffer.String())
}