From acad12915d3d9690f9e4fe09528a12cf0bc2deb7 Mon Sep 17 00:00:00 2001 From: Suleiman Dibirov <3595194+idsulik@users.noreply.github.com> Date: Thu, 30 Jan 2025 00:10:52 +0200 Subject: [PATCH] chore: Fix BuildContextCompressionLevel description, output the level (#9688) * chore: Fix BuildContextCompressionLevel description, output the level Signed-off-by: Suleiman Dibirov * fixes Signed-off-by: Suleiman Dibirov --------- Signed-off-by: Suleiman Dibirov --- docs-v2/content/en/schemas/v4beta12.json | 4 ++-- pkg/skaffold/build/cluster/kaniko.go | 1 + pkg/skaffold/schema/latest/config.go | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs-v2/content/en/schemas/v4beta12.json b/docs-v2/content/en/schemas/v4beta12.json index 24cd4c39e4d..9f7232ff241 100755 --- a/docs-v2/content/en/schemas/v4beta12.json +++ b/docs-v2/content/en/schemas/v4beta12.json @@ -2672,8 +2672,8 @@ }, "buildContextCompressionLevel": { "type": "integer", - "description": "gzip compression level for the build context.", - "x-intellij-html-description": "gzip compression level for the build context.", + "description": "gzip compression level(0-9) for the build context. 0: NoCompression. 1: BestSpeed. 9: BestCompression. -1: DefaultCompression. -2: HuffmanOnly.", + "x-intellij-html-description": "gzip compression level(0-9) for the build context. 0: NoCompression. 1: BestSpeed. 9: BestCompression. -1: DefaultCompression. -2: HuffmanOnly.", "default": "1" }, "cache": { diff --git a/pkg/skaffold/build/cluster/kaniko.go b/pkg/skaffold/build/cluster/kaniko.go index 703befbd979..95c583dd845 100644 --- a/pkg/skaffold/build/cluster/kaniko.go +++ b/pkg/skaffold/build/cluster/kaniko.go @@ -139,6 +139,7 @@ func (b *Builder) copyKanikoBuildContext(ctx context.Context, out io.Writer, wor errs := make(chan error, 1) buildCtxReader, buildCtxWriter := io.Pipe() gzipWriter, err := gzip.NewWriterLevel(buildCtxWriter, *artifact.BuildContextCompressionLevel) + log.Entry(ctx).Infof("Using gzip compression level %d", *artifact.BuildContextCompressionLevel) if err != nil { return fmt.Errorf("creating gzip writer: %w", err) diff --git a/pkg/skaffold/schema/latest/config.go b/pkg/skaffold/schema/latest/config.go index a4e8026c9c5..88955bcb8c0 100644 --- a/pkg/skaffold/schema/latest/config.go +++ b/pkg/skaffold/schema/latest/config.go @@ -1555,13 +1555,13 @@ type KanikoArtifact struct { // Defaults to 5 minutes (`5m`). CopyTimeout string `yaml:"copyTimeout,omitempty"` - // BuildContextCompressionLevel is the gzip compression level for the build context. + // BuildContextCompressionLevel is the gzip compression level(0-9) for the build context. + // 0: NoCompression. + // 1: BestSpeed. + // 9: BestCompression. + // -1: DefaultCompression. + // -2: HuffmanOnly. // Defaults to `1`. - // 0: NoCompression - // 1: BestSpeed - // 9: BestCompression - // -1: DefaultCompression - // -2: HuffmanOnly BuildContextCompressionLevel *int `yaml:"buildContextCompressionLevel,omitempty"` }