Skip to content

Commit

Permalink
Add support for Kaniko flag --image-fs-extract-retry (#6380)
Browse files Browse the repository at this point in the history
  • Loading branch information
RabidFire authored Aug 10, 2021
1 parent 638bec4 commit c9714c5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/content/en/schemas/v2beta21.json
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,11 @@
"description": "Docker image used by the Kaniko pod. Defaults to the latest released version of `gcr.io/kaniko-project/executor`.",
"x-intellij-html-description": "Docker image used by the Kaniko pod. Defaults to the latest released version of <code>gcr.io/kaniko-project/executor</code>."
},
"imageFSExtractRetry": {
"type": "string",
"description": "number of retries that should happen for extracting an image filesystem.",
"x-intellij-html-description": "number of retries that should happen for extracting an image filesystem."
},
"imageNameWithDigestFile": {
"type": "string",
"description": "specify a file to save the image name with digest of the built image to.",
Expand Down Expand Up @@ -2335,6 +2340,7 @@
"initImage",
"image",
"digestFile",
"imageFSExtractRetry",
"imageNameWithDigestFile",
"logFormat",
"ociLayoutPath",
Expand Down
10 changes: 10 additions & 0 deletions pkg/skaffold/build/gcb/kaniko_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,16 @@ func TestKanikoBuildSpec(t *testing.T) {
kaniko.ForceFlag,
},
},
{
description: "with ImageFSExtractRetry",
artifact: &latestV1.KanikoArtifact{
DockerfilePath: "Dockerfile",
ImageFSExtractRetry: "5",
},
expectedArgs: []string{
"--image-fs-extract-retry", "5",
},
},
{
description: "with ImageNameWithDigestFile",
artifact: &latestV1.KanikoArtifact{
Expand Down
4 changes: 4 additions & 0 deletions pkg/skaffold/build/kaniko/args.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func Args(artifact *latestV1.KanikoArtifact, tag, context string) ([]string, err
args = append(args, ForceFlag)
}

if artifact.ImageFSExtractRetry != "" {
args = append(args, ImageFSExtractRetryFlag, artifact.ImageFSExtractRetry)
}

if artifact.ImageNameWithDigestFile != "" {
args = append(args, ImageNameWithDigestFileFlag, artifact.ImageNameWithDigestFile)
}
Expand Down
2 changes: 2 additions & 0 deletions pkg/skaffold/build/kaniko/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const (
DigestFileFlag = "--digest-file"
// ForceFlag additional flag
ForceFlag = "--force"
// ImageFSExtractRetry additional flag
ImageFSExtractRetryFlag = "--image-fs-extract-retry"
// ImageNameWithDigestFileFlag additional flag
ImageNameWithDigestFileFlag = "--image-name-with-digest-file"
// InsecureFlag additional flag
Expand Down
3 changes: 3 additions & 0 deletions pkg/skaffold/schema/latest/v1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,9 @@ type KanikoArtifact struct {
// This can be used to automatically track the exact image built by kaniko.
DigestFile string `yaml:"digestFile,omitempty"`

// ImageFSExtractRetry is the number of retries that should happen for extracting an image filesystem.
ImageFSExtractRetry string `yaml:"imageFSExtractRetry,omitempty"`

// ImageNameWithDigestFile specify a file to save the image name with digest of the built image to.
ImageNameWithDigestFile string `yaml:"imageNameWithDigestFile,omitempty"`

Expand Down

0 comments on commit c9714c5

Please sign in to comment.