This repository was archived by the owner on May 4, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ package builder
1717import (
1818 "fmt"
1919 "hash/crc32"
20+ "os"
2021 "strconv"
2122
2223 "github.com/uber/makisu/lib/cache"
@@ -161,6 +162,9 @@ func (plan *BuildPlan) processStagesAndAliases(
161162
162163// Execute executes all build stages in order.
163164func (plan * BuildPlan ) Execute () (* image.DistributionManifest , error ) {
165+ // We need to backup the original env to restore it between stages
166+ orignalEnv := utils .ConvertStringSliceToMap (os .Environ ())
167+
164168 var currStage * buildStage
165169 for k := 0 ; k < len (plan .stages ); k ++ {
166170 currStage = plan .stages [k ]
@@ -178,6 +182,12 @@ func (plan *BuildPlan) Execute() (*image.DistributionManifest, error) {
178182 if err := plan .executeStage (currStage , lastStage , copiedFrom ); err != nil {
179183 return nil , fmt .Errorf ("execute stage: %s" , err )
180184 }
185+
186+ // Restore env
187+ os .Clearenv ()
188+ for k , v := range orignalEnv {
189+ os .Setenv (k , v )
190+ }
181191 }
182192
183193 // Wait for cache layers to be pushed. This will make them available to
You can’t perform that action at this time.
0 commit comments