From f9ac4e7431ade9a785efd7e9f23f9bece819e051 Mon Sep 17 00:00:00 2001 From: Nao YONASHIRO Date: Wed, 5 Jun 2019 01:48:12 +0900 Subject: [PATCH] refactor: avoid twice parse Dockerfile --- pkg/executor/build.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/executor/build.go b/pkg/executor/build.go index 6626577cf9..70f0d8f01d 100644 --- a/pkg/executor/build.go +++ b/pkg/executor/build.go @@ -361,6 +361,10 @@ func CalculateDependencies(opts *config.KanikoOptions) (map[int][]string, error) if err != nil { return nil, err } + return calculateDependencies(stages, opts) +} + +func calculateDependencies(stages []config.KanikoStage, opts *config.KanikoOptions) (map[int][]string, error) { images := []v1.Image{} depGraph := map[int][]string{} for _, s := range stages { @@ -434,7 +438,7 @@ func DoBuild(opts *config.KanikoOptions) (v1.Image, error) { return nil, err } - crossStageDependencies, err := CalculateDependencies(opts) + crossStageDependencies, err := calculateDependencies(stages, opts) if err != nil { return nil, err }