Repository: GoogleContainerTools/skaffold
Pull request #8697 (2023-04-20 21:21:01)

feat: add custom actions execution modes to `inspect executionModes list`
**Related**: #8609 

**Description**
This PR extend the `inspect executionModes list` command to include the information detected in the `customActions` stanza.

codecov[bot]: ## [Codecov](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) Report
> Merging [#8697](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) (0253ede) into [main](https://codecov.io/gh/GoogleContainerTools/skaffold/commit/290280e8c6c19231e9ed5b5c027f2c01d22f75be?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) (290280e) will **decrease** coverage by `5.99%`.
> The diff coverage is `54.27%`.

```diff
@@            Coverage Diff             @@
##             main    #8697      +/-   ##
==========================================
- Coverage   70.48%   64.50%   -5.99%     
==========================================
  Files         515      616     +101     
  Lines       23150    30994    +7844     
==========================================
+ Hits        16317    19992    +3675     
- Misses       5776     9502    +3726     
- Partials     1057     1500     +443     
```


| [Impacted Files](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) | Coverage Δ | |
|---|---|---|
| [cmd/skaffold/app/cmd/completion.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvY29tcGxldGlvbi5nbw==) | `13.04% <0.00%> (-1.25%)` | :arrow_down: |
| [cmd/skaffold/app/cmd/config/list.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvY29uZmlnL2xpc3QuZ28=) | `65.21% <ø> (ø)` | |
| [cmd/skaffold/app/cmd/config/set.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvY29uZmlnL3NldC5nbw==) | `88.72% <ø> (ø)` | |
| [cmd/skaffold/app/cmd/config/util.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvY29uZmlnL3V0aWwuZ28=) | `54.28% <ø> (ø)` | |
| [cmd/skaffold/app/cmd/credits.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvY3JlZGl0cy5nbw==) | `100.00% <ø> (ø)` | |
| [cmd/skaffold/app/cmd/credits/export.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvY3JlZGl0cy9leHBvcnQuZ28=) | `0.00% <0.00%> (ø)` | |
| [cmd/skaffold/app/cmd/deploy.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvZGVwbG95Lmdv) | `40.90% <0.00%> (-12.94%)` | :arrow_down: |
| [cmd/skaffold/app/cmd/generate\_pipeline.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvZ2VuZXJhdGVfcGlwZWxpbmUuZ28=) | `60.00% <ø> (ø)` | |
| [cmd/skaffold/app/cmd/inspect\_modules.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvaW5zcGVjdF9tb2R1bGVzLmdv) | `65.00% <ø> (ø)` | |
| [cmd/skaffold/app/cmd/inspect\_profiles.go](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools#diff-Y21kL3NrYWZmb2xkL2FwcC9jbWQvaW5zcGVjdF9wcm9maWxlcy5nbw==) | `66.66% <ø> (ø)` | |
| ... and [39 more](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools) | |

... and [406 files with indirect coverage changes](https://codecov.io/gh/GoogleContainerTools/skaffold/pull/8697/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools)

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=GoogleContainerTools)


Patch:
diff --git a/docs-v2/content/en/schemas/v4beta5.json b/docs-v2/content/en/schemas/v4beta5.json
index c55ac59e6..c29997e22 100755
--- a/docs-v2/content/en/schemas/v4beta5.json
+++ b/docs-v2/content/en/schemas/v4beta5.json
@@ -2606,12 +2606,6 @@
           "x-intellij-html-description": "to add timestamps to log format.",
           "default": "false"
         },
-        "noPush": {
-          "type": "boolean",
-          "description": "if you only want to build the image, without pushing to a registry.",
-          "x-intellij-html-description": "if you only want to build the image, without pushing to a registry.",
-          "default": "false"
-        },
         "ociLayoutPath": {
           "type": "string",
           "description": "to specify a directory in the container where the OCI image layout of a built image will be placed. This can be used to automatically track the exact image built by kaniko.",
@@ -2719,7 +2713,6 @@
         "cleanup",
         "insecure",
         "insecurePull",
-        "noPush",
         "force",
         "logTimestamp",
         "reproducible",
diff --git a/pkg/skaffold/build/kaniko/args.go b/pkg/skaffold/build/kaniko/args.go
index 05ded7ebe..4d2bdf67a 100644
--- a/pkg/skaffold/build/kaniko/args.go
+++ b/pkg/skaffold/build/kaniko/args.go
@@ -101,10 +101,6 @@ func Args(artifact *latest.KanikoArtifact, tag, context string) ([]string, error
 		args = append(args, LogTimestampFlag)
 	}
 
-	if artifact.NoPush {
-		args = append(args, NoPushFlag)
-	}
-
 	if artifact.OCILayoutPath != "" {
 		args = append(args, OCILayoutFlag, artifact.OCILayoutPath)
 	}
diff --git a/pkg/skaffold/build/kaniko/types.go b/pkg/skaffold/build/kaniko/types.go
index c47251881..21291e9b7 100644
--- a/pkg/skaffold/build/kaniko/types.go
+++ b/pkg/skaffold/build/kaniko/types.go
@@ -53,8 +53,6 @@ const (
 	LogFormatFlag = "--log-format"
 	// LogTimestampFlag additional flag
 	LogTimestampFlag = "--log-timestamp"
-	// NoPushFlag additional flag
-	NoPushFlag = "--no-push"
 	// OCILayoutFlag additional flag
 	OCILayoutFlag = "--oci-layout-path"
 	// RegistryCertificateFlag additional flag
diff --git a/pkg/skaffold/inspect/executionModes/list.go b/pkg/skaffold/inspect/executionModes/list.go
index 011129644..49f5ce79d 100644
--- a/pkg/skaffold/inspect/executionModes/list.go
+++ b/pkg/skaffold/inspect/executionModes/list.go
@@ -48,6 +48,8 @@ func PrintExecutionModesList(ctx context.Context, out io.Writer, opts inspect.Op
 		CustomActionsExecutionModes: map[string]string{},
 	}
 
+	allActions := map[string]string{}
+
 	for _, c := range cfgs {
 		for _, tc := range c.Verify {
 			if tc.ExecutionMode.KubernetesClusterExecutionMode != nil {
@@ -56,8 +58,21 @@ func PrintExecutionModesList(ctx context.Context, out io.Writer, opts inspect.Op
 				l.VerifyExecutionModes[tc.Name] = "local"
 			}
 		}
+
+		for _, a := range c.CustomActions {
+			if a.ExecutionModeConfig.KubernetesClusterExecutionMode != nil {
+				allActions[a.Name] = "kubernetesCluster"
+			} else {
+				allActions[a.Name] = "local"
+			}
+		}
+	}
+
+	for _, a := range customActions {
+		if execMode, found := allActions[a]; found {
+			l.CustomActionsExecutionModes[a] = execMode
+		}
 	}
-	// TODO(#8572) add similar logic for customAction schema fields when they are complete
 
 	return formatter.Write(l)
 }


Test patch:
diff --git a/pkg/skaffold/build/gcb/kaniko_test.go b/pkg/skaffold/build/gcb/kaniko_test.go
index d9c8d0e6d..0f8e88fe1 100644
--- a/pkg/skaffold/build/gcb/kaniko_test.go
+++ b/pkg/skaffold/build/gcb/kaniko_test.go
@@ -194,16 +194,6 @@ func TestKanikoBuildSpec(t *testing.T) {
 				kaniko.LogTimestampFlag,
 			},
 		},
-		{
-			description: "with NoPush",
-			artifact: &latest.KanikoArtifact{
-				DockerfilePath: "Dockerfile",
-				NoPush:         true,
-			},
-			expectedArgs: []string{
-				kaniko.NoPushFlag,
-			},
-		},
 		{
 			description: "with OCILayoutPath",
 			artifact: &latest.KanikoArtifact{
diff --git a/pkg/skaffold/build/kaniko/args_test.go b/pkg/skaffold/build/kaniko/args_test.go
index f00c65de3..b66f308d1 100644
--- a/pkg/skaffold/build/kaniko/args_test.go
+++ b/pkg/skaffold/build/kaniko/args_test.go
@@ -187,17 +187,6 @@ func TestArgs(t *testing.T) {
 			},
 			wantErr: false,
 		},
-		{
-			description: "with NoPush",
-			artifact: &latest.KanikoArtifact{
-				DockerfilePath: "dir/Dockerfile",
-				NoPush:         true,
-			},
-			expectedArgs: []string{
-				NoPushFlag,
-			},
-			wantErr: false,
-		},
 		{
 			description: "with OCILayoutPath",
 			artifact: &latest.KanikoArtifact{
diff --git a/pkg/skaffold/inspect/executionModes/list_test.go b/pkg/skaffold/inspect/executionModes/list_test.go
index a0c924a81..d192d8fe1 100644
--- a/pkg/skaffold/inspect/executionModes/list_test.go
+++ b/pkg/skaffold/inspect/executionModes/list_test.go
@@ -67,6 +67,24 @@ func TestPrintExecutionModesList(t *testing.T) {
 			err:         errors.New("some error occurred"),
 			expected:    `{"errorCode":"INSPECT_UNKNOWN_ERR","errorMessage":"some error occurred"}` + "\n",
 		},
+		{
+			description:   "print executionModes for k8s custom action",
+			expected:      `{"verifyExecutionModes":{},"customActionsExecutionModes":{"action1":"kubernetesCluster"}}` + "\n",
+			customActions: []string{"action1"},
+			module:        []string{"cfg-with-customActions"},
+		},
+		{
+			description:   "print executionModes for local custom action",
+			expected:      `{"verifyExecutionModes":{},"customActionsExecutionModes":{"action2":"local"}}` + "\n",
+			customActions: []string{"action2"},
+			module:        []string{"cfg-with-customActions"},
+		},
+		{
+			description:   "print executionModes for custom action and verify",
+			expected:      `{"verifyExecutionModes":{"bar":"kubernetesCluster"},"customActionsExecutionModes":{"action1":"kubernetesCluster"}}` + "\n",
+			customActions: []string{"action1"},
+			module:        []string{"cfg-with-customActions-and-verify"},
+		},
 	}
 
 	for _, test := range tests {
@@ -115,6 +133,73 @@ func TestPrintExecutionModesList(t *testing.T) {
 						},
 					},
 				}, SourceFile: "path/to/cfg-with-default-namespace"},
+
+				&parser.SkaffoldConfigEntry{SkaffoldConfig: &latest.SkaffoldConfig{
+					Metadata: latest.Metadata{Name: "cfg-with-customActions"},
+					Pipeline: latest.Pipeline{
+						CustomActions: []latest.Action{
+							{
+								Name: "action1",
+								ExecutionModeConfig: latest.ActionExecutionModeConfig{
+									VerifyExecutionModeType: latest.VerifyExecutionModeType{
+										KubernetesClusterExecutionMode: &latest.KubernetesClusterVerifier{},
+									},
+								},
+								Containers: []latest.VerifyContainer{
+									{
+										Name:  "task1",
+										Image: "task1-image",
+									},
+								},
+							},
+							{
+								Name: "action2",
+								Containers: []latest.VerifyContainer{
+									{
+										Name:  "task2",
+										Image: "task2-image",
+									},
+								},
+							},
+						},
+					},
+				}, SourceFile: "path/to/cfg-with-customActions"},
+
+				&parser.SkaffoldConfigEntry{SkaffoldConfig: &latest.SkaffoldConfig{
+					Metadata: latest.Metadata{Name: "cfg-with-customActions-and-verify"},
+					Pipeline: latest.Pipeline{
+						Verify: []*latest.VerifyTestCase{
+							{
+								Name: "bar",
+								Container: latest.VerifyContainer{
+									Name:  "bar",
+									Image: "bar",
+								},
+								ExecutionMode: latest.VerifyExecutionModeConfig{
+									VerifyExecutionModeType: latest.VerifyExecutionModeType{
+										KubernetesClusterExecutionMode: &latest.KubernetesClusterVerifier{},
+									},
+								},
+							},
+						},
+						CustomActions: []latest.Action{
+							{
+								Name: "action1",
+								ExecutionModeConfig: latest.ActionExecutionModeConfig{
+									VerifyExecutionModeType: latest.VerifyExecutionModeType{
+										KubernetesClusterExecutionMode: &latest.KubernetesClusterVerifier{},
+									},
+								},
+								Containers: []latest.VerifyContainer{
+									{
+										Name:  "task1",
+										Image: "task1-image",
+									},
+								},
+							},
+						},
+					},
+				}, SourceFile: "path/to/cfg-with-customActions-and-verify"},
 			}
 			t.Override(&inspect.GetConfigSet, func(_ context.Context, opts config.SkaffoldOptions) (parser.SkaffoldConfigSet, error) {
 				// mock profile activation
diff --git a/pkg/skaffold/schema/latest/config.go b/pkg/skaffold/schema/latest/config.go
index 5749f1a6e..24cec608e 100644
--- a/pkg/skaffold/schema/latest/config.go
+++ b/pkg/skaffold/schema/latest/config.go
@@ -1344,9 +1344,6 @@ type KanikoArtifact struct {
 	// InsecurePull if you want to pull images from a plain HTTP registry.
 	InsecurePull bool `yaml:"insecurePull,omitempty"`
 
-	// NoPush if you only want to build the image, without pushing to a registry.
-	NoPush bool `yaml:"noPush,omitempty"`
-
 	// Force building outside of a container.
 	Force bool `yaml:"force,omitempty"`