diff --git a/.gitignore b/.gitignore index 30eb36943..f0074f1e7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,12 @@ benchmarks.test # Jetbrains Goland .idea/ +# Visual Studio Code +.vscode/ + # Build outputs artifacts/ .DS_Store # Travis unencrypted file .travis/key.pem - diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 32c15aa30..000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch Package", - "type": "go", - "request": "launch", - "mode": "test", - "program": "${fileDirname}", - "buildFlags": ["-tags=acceptance"] - } - ] -} \ No newline at end of file diff --git a/internal/build/lifecycle_execution.go b/internal/build/lifecycle_execution.go index d65dfdba8..9be5f8979 100644 --- a/internal/build/lifecycle_execution.go +++ b/internal/build/lifecycle_execution.go @@ -577,14 +577,12 @@ func (l *LifecycleExecution) Restore(ctx context.Context, buildCache Cache, kani func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCache Cache, phaseFactory PhaseFactory) error { var flags []string - var args []string - - args = []string{l.opts.Image.String()} + args := []string{l.opts.Image.String()} platformAPILessThan07 := l.platformAPI.LessThan("0.7") cacheBindOp := NullOp() - if l.opts.ClearCache || l.opts.DetectOnly { + if l.opts.ClearCache || buildCache == nil { if platformAPILessThan07 || l.platformAPI.AtLeast("0.9") { args = prependArg("-skip-layers", args) } @@ -601,7 +599,7 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach } launchCacheBindOp := NullOp() - if l.platformAPI.AtLeast("0.9") && !l.opts.DetectOnly { + if l.platformAPI.AtLeast("0.9") && launchCache != nil { if !l.opts.Publish { args = append([]string{"-launch-cache", l.mountPaths.launchCacheDir()}, args...) launchCacheBindOp = WithBinds(fmt.Sprintf("%s:%s", launchCache.Name(), l.mountPaths.launchCacheDir())) @@ -616,7 +614,7 @@ func (l *LifecycleExecution) Analyze(ctx context.Context, buildCache, launchCach flags = append(flags, "-uid", strconv.Itoa(l.opts.UID)) } - if l.opts.PreviousImage != "" || !l.opts.DetectOnly { + if l.opts.PreviousImage != "" { if l.opts.Image == nil { return errors.New("image can't be nil") }