Skip to content

Commit 5bc1e64

Browse files
committed
fix: add stepaction as a valid kind in the hub resolver
The hub resolver should consider StepAction as a valid kind. This change ensures that the controller considers a stepaction as a valid kind resolving through a hub resolver. test: validate step actions in hub resolver
1 parent 5b082b1 commit 5bc1e64

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

pkg/remoteresolution/resolver/hub/resolver_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,16 @@ func TestValidate(t *testing.T) {
6060
version: "bar",
6161
catalog: "baz",
6262
hubType: ArtifactHubType,
63-
}, {
63+
},
64+
{
65+
testName: "stepaction validation",
66+
kind: "stepaction",
67+
resourceName: "foo",
68+
version: "bar",
69+
catalog: "baz",
70+
hubType: ArtifactHubType,
71+
},
72+
{
6473
testName: "tekton type validation",
6574
kind: "task",
6675
resourceName: "foo",
@@ -134,7 +143,7 @@ func TestValidateConflictingKindName(t *testing.T) {
134143
hubType string
135144
}{
136145
{
137-
kind: "not-taskpipeline",
146+
kind: "not-taskpipelineorstepaction",
138147
name: "foo",
139148
version: "bar",
140149
catalog: "baz",

pkg/resolution/resolver/hub/resolver.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,8 @@ func validateParams(ctx context.Context, paramsMap map[string]string, tektonHubU
359359
missingParams = append(missingParams, ParamVersion)
360360
}
361361
if kind, ok := paramsMap[ParamKind]; ok {
362-
if kind != "task" && kind != "pipeline" {
363-
return errors.New("kind param must be task or pipeline")
362+
if kind != "task" && kind != "pipeline" && kind != "stepaction" {
363+
return errors.New("kind param must be either a task, pipeline or a stepaction")
364364
}
365365
}
366366
if hubType, ok := paramsMap[ParamType]; ok {

pkg/resolution/resolver/hub/resolver_test.go

+11-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@ func TestValidateParams(t *testing.T) {
6262
version: "bar",
6363
catalog: "baz",
6464
hubType: ArtifactHubType,
65-
}, {
65+
},
66+
{
67+
testName: "stepaction validation",
68+
kind: "stepaction",
69+
resourceName: "foo",
70+
version: "bar",
71+
catalog: "baz",
72+
hubType: ArtifactHubType,
73+
},
74+
{
6675
testName: "tekton type validation",
6776
kind: "task",
6877
resourceName: "foo",
@@ -148,7 +157,7 @@ func TestValidateParamsConflictingKindName(t *testing.T) {
148157
hubType string
149158
}{
150159
{
151-
kind: "not-taskpipeline",
160+
kind: "not-taskpipelineorstepaction",
152161
name: "foo",
153162
version: "bar",
154163
catalog: "baz",

0 commit comments

Comments
 (0)