From 067335a239575c22f76e592cf4fbed405daf9b89 Mon Sep 17 00:00:00 2001 From: Yi-Jyun Pan Date: Wed, 16 Aug 2023 13:26:44 +0800 Subject: [PATCH] fix(lib): Allow overriding "CI" variable --- pkg/zeaburpack/image.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/zeaburpack/image.go b/pkg/zeaburpack/image.go index b0fe4df1..975db952 100644 --- a/pkg/zeaburpack/image.go +++ b/pkg/zeaburpack/image.go @@ -45,6 +45,12 @@ func buildImage(opt *buildImageOptions) error { // build the dockerfile dockerfileEnv := "" + + // Inject CI env so everyone knows that we are a CI. + if _, ok := resolvedVars["CI"]; !ok { + dockerfileEnv += "ENV CI true\n" + } + for _, key := range sortedResolvedVarsKey { value := resolvedVars[key] @@ -56,9 +62,6 @@ func buildImage(opt *buildImageOptions) error { dockerfileEnv += "ENV " + key + " " + value + "\n" } - // Inject CI env so everyone knows that we are a CI. - dockerfileEnv += "ENV CI true\n" - for _, stageLine := range stageLines { lines[stageLine] = lines[stageLine] + "\n" + dockerfileEnv + "\n" }