From 4c0f7819996a6b772467738b49e46986ecc0f13a Mon Sep 17 00:00:00 2001 From: Hemanth Mantri Date: Mon, 1 Jul 2024 14:06:19 -0700 Subject: [PATCH] [CI-13182]: Use snapshot-mode instead of snapshotMode (#118) The kaniko flag `snapshotMode` is deprecated in favor of `snapshot-mode`. The default value of `snapshot-mode` is `full`. As a result, the `optimize` flag set in Harness CI's `BuildAndPushToDocker` steps doesn't behave as expected because the `full` mode triggers a full filesystem scan which is slow. The `optimize` flag in Harness translates to `snapshot-mode=redo` which means only filesystem deltas are compared which is much faster. This change fixes the flag name being sent to Kaniko executor. I verified that the executor present in the current version already supports this flag as shown below: ``` hemanthkumarmantri@Hemanth Kumar harness-core % docker run -it --entrypoint /kaniko/executor plugins/kaniko:1.8.10 --help | grep snapshot-mode --snapshot-mode string Change the file attributes inspected during snapshotting (default "full") --snapshotMode string This flag is deprecated. Please use '--snapshot-mode'. ``` --- kaniko.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kaniko.go b/kaniko.go index 0b65461..5437277 100644 --- a/kaniko.go +++ b/kaniko.go @@ -222,7 +222,7 @@ func (p Plugin) Exec() error { } if p.Build.SnapshotMode != "" { - cmdArgs = append(cmdArgs, fmt.Sprintf("--snapshotMode=%s", p.Build.SnapshotMode)) + cmdArgs = append(cmdArgs, fmt.Sprintf("--snapshot-mode=%s", p.Build.SnapshotMode)) } if p.Build.EnableCache {