Repository: GoogleContainerTools/skaffold
Pull request #8470 (2023-02-23 16:36:33)

chore: upgrade kpt to support parameterization
<!-- Thank you for your contribution! -->

 - extracted from #8425 to clarify pr responsibility 
 - cannot find a stable version from kpt release page https://github.com/GoogleContainerTools/kpt/releases so use the beta version



Patch:
diff --git a/deploy/skaffold/Dockerfile.deps b/deploy/skaffold/Dockerfile.deps
index 17876eb5f..33e1aceaf 100644
--- a/deploy/skaffold/Dockerfile.deps
+++ b/deploy/skaffold/Dockerfile.deps
@@ -48,7 +48,7 @@ RUN tar -xvf kustomize.tar.gz
 # Download kpt
 FROM alpine:3.10 as download-kpt
 ARG ARCH
-ENV KPT_VERSION 0.39.3
+ENV KPT_VERSION 1.0.0-beta.24
 ENV KPT_URL https://storage.googleapis.com/skaffold/deps/kpt/v${KPT_VERSION}/kpt_linux_amd64
 COPY deploy/skaffold/digests/kpt.${ARCH}.sha256 .
 RUN wget -O kpt "${KPT_URL}" && sha256sum -c kpt.${ARCH}.sha256
diff --git a/deploy/skaffold/Dockerfile.deps.lts b/deploy/skaffold/Dockerfile.deps.lts
index bcdbef71e..915c52079 100644
--- a/deploy/skaffold/Dockerfile.deps.lts
+++ b/deploy/skaffold/Dockerfile.deps.lts
@@ -48,7 +48,7 @@ RUN tar -xvf kustomize.tar.gz
 # Download kpt
 FROM alpine:3.10 as download-kpt
 ARG ARCH
-ENV KPT_VERSION 0.39.3
+ENV KPT_VERSION 1.0.0-beta.24
 ENV KPT_URL https://storage.googleapis.com/skaffold/deps/kpt/v${KPT_VERSION}/kpt_linux_amd64
 COPY deploy/skaffold/digests/kpt.${ARCH}.sha256 .
 RUN wget -O kpt "${KPT_URL}" && sha256sum -c kpt.${ARCH}.sha256
diff --git a/deploy/skaffold/Dockerfile.deps.slim b/deploy/skaffold/Dockerfile.deps.slim
index 0bfe6df39..bcf5a02d6 100644
--- a/deploy/skaffold/Dockerfile.deps.slim
+++ b/deploy/skaffold/Dockerfile.deps.slim
@@ -48,7 +48,7 @@ RUN tar -xvf kustomize.tar.gz
 # Download kpt
 FROM alpine:3.10 as download-kpt
 ARG ARCH
-ENV KPT_VERSION 0.39.3
+ENV KPT_VERSION 1.0.0-beta.24
 ENV KPT_URL https://storage.googleapis.com/skaffold/deps/kpt/v${KPT_VERSION}/kpt_linux_amd64
 COPY deploy/skaffold/digests/kpt.${ARCH}.sha256 .
 RUN wget -O kpt "${KPT_URL}" && sha256sum -c kpt.${ARCH}.sha256
diff --git a/deploy/skaffold/digests/kpt.amd64.sha256 b/deploy/skaffold/digests/kpt.amd64.sha256
index efdf009a7..4bcfb791e 100644
--- a/deploy/skaffold/digests/kpt.amd64.sha256
+++ b/deploy/skaffold/digests/kpt.amd64.sha256
@@ -1,1 +1,1 @@
-3acf9123f98b0816d86d6abbcdcfbf15c6053a830105233534a14dbbd0387ed7  kpt
+315547defaef2430f9bb71f60fd55a54a8f7055ae017ee72fc26e7773b1f634e  kpt
diff --git a/docs-v2/content/en/docs/workflows/dev.md b/docs-v2/content/en/docs/workflows/dev.md
index f46dd0519..fdc1639e5 100644
--- a/docs-v2/content/en/docs/workflows/dev.md
+++ b/docs-v2/content/en/docs/workflows/dev.md
@@ -19,7 +19,9 @@ Running `skaffold dev` is equivalent to running the IDE command `Run on Kubernet
 
 ## Dev loop
 
-When `skaffold dev` is run, Skaffold will first do a full build, test and deploy of all artifacts specified in the `skaffold.yaml`, similar to `skaffold run`. Upon successful build, test and deploy, Skaffold will start watching all source file dependencies for all artifacts specified in the project. As changes are made to these source files, Skaffold will rebuild and retest the associated artifacts, and redeploy the new changes to your cluster.
+When `skaffold dev` is run, Skaffold will first do a full build, test, render and deploy of all artifacts specified in the `skaffold.yaml`, similar to `skaffold run`. By default, Skaffold will exit if any of these stages fails.  Upon successful build, test, render and deploy, Skaffold will start watching all source file dependencies for all artifacts specified in the project. As changes are made to these source files, Skaffold will rebuild and retest the associated artifacts, and redeploy the new changes to your cluster.
+
+The ``--keep-running-on-failure`` flag can be used to keep Skaffold running by suspending the Skaffold session while encountering errors in the first build, test, render, deploy. The user can attempt to fix the errors and then restore the session by pressing any key or exit the session with ``Ctrl+C``. The session will be suspended again unless the errors are fixed.  Using this flag should result in an better experience for `dev` sessions where errors occur that would otherwise cause Skaffold to exit
 
 The dev loop will run until the user cancels the Skaffold process with `Ctrl+C`. Upon receiving this signal, Skaffold will clean up all deployed artifacts on the active cluster, meaning that Skaffold won't abandon any Kubernetes resources that it created throughout the lifecycle of the run. This can be optionally disabled by using the `--no-prune` flag.
 
diff --git a/docs-v2/content/en/schemas/v4beta3.json b/docs-v2/content/en/schemas/v4beta3.json
index 037357e21..e3a4dad2c 100755
--- a/docs-v2/content/en/schemas/v4beta3.json
+++ b/docs-v2/content/en/schemas/v4beta3.json
@@ -2063,23 +2063,6 @@
       "description": "defines the manifests from helm releases.",
       "x-intellij-html-description": "defines the manifests from helm releases."
     },
-    "HelmConventionConfig": {
-      "properties": {
-        "explicitRegistry": {
-          "type": "boolean",
-          "description": "separates `image.registry` to the image config syntax. Useful for some charts e.g. `postgresql`.",
-          "x-intellij-html-description": "separates <code>image.registry</code> to the image config syntax. Useful for some charts e.g. <code>postgresql</code>.",
-          "default": "false"
-        }
-      },
-      "preferredOrder": [
-        "explicitRegistry"
-      ],
-      "additionalProperties": false,
-      "type": "object",
-      "description": "image config in the syntax of image.repository and image.tag.",
-      "x-intellij-html-description": "image config in the syntax of image.repository and image.tag."
-    },
     "HelmDeployFlags": {
       "properties": {
         "global": {
@@ -2120,44 +2103,6 @@
       "description": "additional option flags that are passed on the command line to `helm`.",
       "x-intellij-html-description": "additional option flags that are passed on the command line to <code>helm</code>."
     },
-    "HelmFQNConfig": {
-      "properties": {
-        "property": {
-          "type": "string",
-          "description": "defines the image config.",
-          "x-intellij-html-description": "defines the image config."
-        }
-      },
-      "preferredOrder": [
-        "property"
-      ],
-      "additionalProperties": false,
-      "type": "object",
-      "description": "image config to use the FullyQualifiedImageName as param to set.",
-      "x-intellij-html-description": "image config to use the FullyQualifiedImageName as param to set."
-    },
-    "HelmImageConfig": {
-      "properties": {
-        "fqn": {
-          "$ref": "#/definitions/HelmFQNConfig",
-          "description": "image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`.",
-          "x-intellij-html-description": "image configuration uses the syntax <code>IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG</code>."
-        },
-        "helm": {
-          "$ref": "#/definitions/HelmConventionConfig",
-          "description": "image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`.",
-          "x-intellij-html-description": "image configuration uses the syntax <code>IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG</code>."
-        }
-      },
-      "preferredOrder": [
-        "fqn",
-        "helm"
-      ],
-      "additionalProperties": false,
-      "type": "object",
-      "description": "describes an image configuration.",
-      "x-intellij-html-description": "describes an image configuration."
-    },
     "HelmPackaged": {
       "properties": {
         "appVersion": {
diff --git a/pkg/skaffold/deploy/helm/util.go b/pkg/skaffold/deploy/helm/util.go
deleted file mode 100644
index f5077c369..000000000
--- a/pkg/skaffold/deploy/helm/util.go
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-Copyright 2020 The Skaffold Authors
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package helm
-
-import (
-	"fmt"
-
-	"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/docker"
-	"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/latest"
-)
-
-// imageSetFromConfig calculates the --set-string value from the helm config
-func imageSetFromConfig(cfg *latest.HelmConventionConfig, valueName string, tag string) (string, error) {
-	if cfg == nil {
-		return fmt.Sprintf("%s=%s", valueName, tag), nil
-	}
-
-	ref, err := docker.ParseReference(tag)
-	if err != nil {
-		return "", fmt.Errorf("cannot parse the image reference %q: %w", tag, err)
-	}
-
-	var imageTag string
-	if ref.Digest != "" {
-		imageTag = fmt.Sprintf("%s@%s", ref.Tag, ref.Digest)
-	} else {
-		imageTag = ref.Tag
-	}
-
-	if cfg.ExplicitRegistry {
-		if ref.Domain == "" {
-			return "", fmt.Errorf("image reference %s has no domain", tag)
-		}
-		return fmt.Sprintf("%[1]s.registry=%[2]s,%[1]s.repository=%[3]s,%[1]s.tag=%[4]s", valueName, ref.Domain, ref.Path, imageTag), nil
-	}
-
-	return fmt.Sprintf("%[1]s.repository=%[2]s,%[1]s.tag=%[3]s", valueName, ref.BaseName, imageTag), nil
-}
diff --git a/pkg/skaffold/deploy/kubectl/kubectl.go b/pkg/skaffold/deploy/kubectl/kubectl.go
index 50faf8b05..c69bbd985 100644
--- a/pkg/skaffold/deploy/kubectl/kubectl.go
+++ b/pkg/skaffold/deploy/kubectl/kubectl.go
@@ -142,9 +142,7 @@ func NewDeployer(cfg Config, labeller *label.DefaultLabeller, d *latest.KubectlD
 		insecureRegistries: cfg.GetInsecureRegistries(),
 		labeller:           labeller,
 		// hydratedManifests refers to the DIR in the `skaffold apply DIR`. Used in both v1 and v2.
-		hydratedManifests: cfg.HydratedManifests(),
-		// hydrationDir refers to the path where the hydrated manifests are stored, this is introduced in v2.
-
+		hydratedManifests:      cfg.HydratedManifests(),
 		transformableAllowlist: transformableAllowlist,
 		transformableDenylist:  transformableDenylist,
 	}, nil
diff --git a/pkg/skaffold/inspect/namespaces/list.go b/pkg/skaffold/inspect/namespaces/list.go
index cca1ea44c..7bdcf8146 100644
--- a/pkg/skaffold/inspect/namespaces/list.go
+++ b/pkg/skaffold/inspect/namespaces/list.go
@@ -42,7 +42,6 @@ type resourceInfo struct {
 }
 
 func PrintNamespacesList(ctx context.Context, out io.Writer, manifestFile string, opts inspect.Options) error {
-	// do some additional processing here
 	b, err := ioutil.ReadFile(manifestFile)
 	if err != nil {
 		return err
diff --git a/pkg/skaffold/kubernetes/util.go b/pkg/skaffold/kubernetes/util.go
index de18d55a8..4272c5add 100644
--- a/pkg/skaffold/kubernetes/util.go
+++ b/pkg/skaffold/kubernetes/util.go
@@ -55,6 +55,9 @@ func HasKubernetesFileExtension(n string) bool {
 // IsKubernetesManifest is for determining if a file is a valid Kubernetes manifest
 func IsKubernetesManifest(file string) bool {
 	_, err := parseKubernetesObjects(file)
+	if err != nil {
+		log.Entry(context.TODO()).Error(err)
+	}
 	return err == nil
 }
 


Test patch:
diff --git a/examples/grpc-e2e-tests/service/go.mod b/examples/grpc-e2e-tests/service/go.mod
index d2b2544d1..e9b851895 100644
--- a/examples/grpc-e2e-tests/service/go.mod
+++ b/examples/grpc-e2e-tests/service/go.mod
@@ -26,7 +26,7 @@ require (
 	golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect
 	golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect
 	golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
-	golang.org/x/text v0.3.7 // indirect
+	golang.org/x/text v0.3.8 // indirect
 	golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/genproto v0.0.0-20220916134934-764224ccc2d1 // indirect
diff --git a/examples/grpc-e2e-tests/service/go.sum b/examples/grpc-e2e-tests/service/go.sum
index 87c29cc88..2e20d53f1 100644
--- a/examples/grpc-e2e-tests/service/go.sum
+++ b/examples/grpc-e2e-tests/service/go.sum
@@ -409,8 +409,9 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
 golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
 golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
+golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
diff --git a/pkg/skaffold/deploy/helm/helm_test.go b/pkg/skaffold/deploy/helm/helm_test.go
index cee6efb35..781f7e266 100644
--- a/pkg/skaffold/deploy/helm/helm_test.go
+++ b/pkg/skaffold/deploy/helm/helm_test.go
@@ -1148,77 +1148,6 @@ func TestHelmDependencies(t *testing.T) {
 	}
 }
 
-func TestImageSetFromConfig(t *testing.T) {
-	tests := []struct {
-		description string
-		valueName   string
-		tag         string
-		expected    string
-		strategy    *latest.HelmConventionConfig
-		shouldErr   bool
-	}{
-		{
-			description: "Helm set values with no convention config",
-			valueName:   "image",
-			tag:         "skaffold-helm:1.0.0",
-			expected:    "image=skaffold-helm:1.0.0",
-			strategy:    nil,
-			shouldErr:   false,
-		},
-		{
-			description: "Helm set values with helm conventions",
-			valueName:   "image",
-			tag:         "skaffold-helm:1.0.0",
-			expected:    "image.repository=skaffold-helm,image.tag=1.0.0",
-			strategy:    &latest.HelmConventionConfig{},
-			shouldErr:   false,
-		},
-		{
-			description: "Helm set values with helm conventions and explicit registry value",
-			valueName:   "image",
-			tag:         "docker.io/skaffold-helm:1.0.0",
-			expected:    "image.registry=docker.io,image.repository=skaffold-helm,image.tag=1.0.0",
-			strategy: &latest.HelmConventionConfig{
-				ExplicitRegistry: true,
-			},
-			shouldErr: false,
-		},
-		{
-			description: "Invalid tag with helm conventions",
-			valueName:   "image",
-			tag:         "skaffold-helm:1.0.0,0",
-			expected:    "",
-			strategy:    &latest.HelmConventionConfig{},
-			shouldErr:   true,
-		},
-		{
-			description: "Helm set values with helm conventions and explicit registry value, but missing in tag",
-			valueName:   "image",
-			tag:         "skaffold-helm:1.0.0",
-			expected:    "",
-			strategy: &latest.HelmConventionConfig{
-				ExplicitRegistry: true,
-			},
-			shouldErr: true,
-		},
-		{
-			description: "Helm set values using digest",
-			valueName:   "image",
-			tag:         "skaffold-helm:stable@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2",
-			expected:    "image.repository=skaffold-helm,image.tag=stable@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2",
-			strategy:    &latest.HelmConventionConfig{},
-			shouldErr:   false,
-		},
-	}
-	for _, test := range tests {
-		testutil.Run(t, test.description, func(t *testutil.T) {
-			values, err := imageSetFromConfig(test.strategy, test.valueName, test.tag)
-			t.CheckError(test.shouldErr, err)
-			t.CheckDeepEqual(test.expected, values)
-		})
-	}
-}
-
 func TestHelmRender(t *testing.T) {
 	tests := []struct {
 		description string
diff --git a/pkg/skaffold/schema/latest/config.go b/pkg/skaffold/schema/latest/config.go
index 82fda813b..6f56ca86b 100644
--- a/pkg/skaffold/schema/latest/config.go
+++ b/pkg/skaffold/schema/latest/config.go
@@ -912,27 +912,6 @@ type HelmPackaged struct {
 	AppVersion string `yaml:"appVersion,omitempty"`
 }
 
-// HelmImageConfig describes an image configuration.
-type HelmImageConfig struct {
-	// HelmFQNConfig is the image configuration uses the syntax `IMAGE-NAME=IMAGE-REPOSITORY:IMAGE-TAG`.
-	HelmFQNConfig *HelmFQNConfig `yaml:"fqn,omitempty" yamltags:"oneOf=helmImageStrategy"`
-
-	// HelmConventionConfig is the image configuration uses the syntax `IMAGE-NAME.repository=IMAGE-REPOSITORY, IMAGE-NAME.tag=IMAGE-TAG`.
-	HelmConventionConfig *HelmConventionConfig `yaml:"helm,omitempty" yamltags:"oneOf=helmImageStrategy"`
-}
-
-// HelmFQNConfig is the image config to use the FullyQualifiedImageName as param to set.
-type HelmFQNConfig struct {
-	// Property defines the image config.
-	Property string `yaml:"property,omitempty"`
-}
-
-// HelmConventionConfig is the image config in the syntax of image.repository and image.tag.
-type HelmConventionConfig struct {
-	// ExplicitRegistry separates `image.registry` to the image config syntax. Useful for some charts e.g. `postgresql`.
-	ExplicitRegistry bool `yaml:"explicitRegistry,omitempty"`
-}
-
 // LogsConfig configures how container logs are printed as a result of a deployment.
 type LogsConfig struct {
 	// Prefix defines the prefix shown on each log line. Valid values are