From 8d9a63855732dfb837e59c9bae00be9bd058b8c9 Mon Sep 17 00:00:00 2001 From: pan93412 Date: Thu, 17 Aug 2023 12:31:24 +0800 Subject: [PATCH] fix(lib): Allow overriding "CI" variable (#125) --- 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" }