Skip to content

Commit deac308

Browse files
authored
Merge pull request #488 from ApsOps/build-args
Fix for #478
2 parents 7fd02cb + 357f9a1 commit deac308

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pkg/gitreceive/k8s_util.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package gitreceive
22

33
import (
4+
"encoding/json"
45
"fmt"
56
"time"
67

@@ -58,6 +59,16 @@ func dockerBuilderPod(
5859

5960
pod := buildPod(debug, name, namespace, pullPolicy, env)
6061

62+
// inject application envvars as a special envvar which will be handled by dockerbuilder to
63+
// inject them as build-time variables.
64+
// NOTE(bacongobbler): docker-py takes buildargs as a json string in the form of
65+
//
66+
// {"KEY": "value"}
67+
//
68+
// So we need to translate the map into json.
69+
dockerBuildArgs, _ := json.Marshal(env)
70+
addEnvToPod(pod, "DOCKER_BUILD_ARGS", string(dockerBuildArgs))
71+
6172
pod.Spec.Containers[0].Name = dockerBuilderName
6273
pod.Spec.Containers[0].Image = image
6374

0 commit comments

Comments
 (0)