Commit 03a07771 authored by Kamil Trzciński's avatar Kamil Trzciński

Pass (public) environment variables received from Coordinator to service containers

parent d31fdae2
......@@ -20,6 +20,7 @@ v 0.5.0 (unreleased)
- Colorize bash output
- Set environment variables from bash script: this fixes problem with su
- Don't cache Dockerfile VOLUMEs
- Pass (public) environment variables received from Coordinator to service containers
v 0.4.2
- Force GC cycle after processing build
......
......@@ -27,6 +27,21 @@ type DockerExecutor struct {
caches []*docker.Container
}
func (s *DockerExecutor) getServiceVariables() []string {
variables := s.Config.Environment
for _, buildVariable := range s.Build.Variables {
if !buildVariable.Public {
continue
}
variable := fmt.Sprintf("%s=%s", buildVariable.Key, buildVariable.Value)
variables = append(variables, variable)
}
return variables
}
func (s *DockerExecutor) getDockerImage(imageName string) (*docker.Image, error) {
s.Debugln("Looking for image", imageName, "...")
image, err := s.client.InspectImage(imageName)
......@@ -249,7 +264,7 @@ func (s *DockerExecutor) createService(service, version string) (*docker.Contain
Name: containerName,
Config: &docker.Config{
Image: serviceImage.ID,
Env: s.Config.Environment,
Env: s.getServiceVariables(),
},
HostConfig: &docker.HostConfig{
RestartPolicy: docker.NeverRestart(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment