From eded993e45d48091d34e23655dbdda0ecaffe29e Mon Sep 17 00:00:00 2001 From: Vincent Demeester Date: Thu, 21 Mar 2024 11:44:26 +0100 Subject: [PATCH] Remove taskref/pipelineref deprecated bundle field This field has been deprecated for about a year and half. So this is removing this field from v1beta1 (it's not present in v1 already). Signed-off-by: Vincent Demeester --- docs/deprecations.md | 3 +- docs/migrating-v1beta1-to-v1.md | 3 + docs/pipelineruns.md | 15 - docs/pipelines.md | 67 +-- docs/taskruns.md | 44 -- .../taskruns/no-ci/tekton-bundles.yaml | 9 - .../pipeline/v1beta1/pipeline_types_test.go | 282 ++++----- .../pipeline/v1beta1/pipeline_validation.go | 26 +- .../v1beta1/pipelineref_conversion.go | 26 +- .../pipeline/v1beta1/pipelineref_types.go | 5 - .../v1beta1/pipelineref_validation.go | 13 - .../v1beta1/pipelineref_validation_test.go | 48 -- .../v1beta1/pipelinerun_conversion_test.go | 72 +-- .../pipeline/v1beta1/taskref_conversion.go | 26 +- pkg/apis/pipeline/v1beta1/taskref_types.go | 5 - .../pipeline/v1beta1/taskref_validation.go | 15 - .../v1beta1/taskref_validation_test.go | 54 -- .../v1beta1/taskrun_conversion_test.go | 550 +++++++++--------- 18 files changed, 421 insertions(+), 842 deletions(-) delete mode 100644 examples/v1beta1/taskruns/no-ci/tekton-bundles.yaml diff --git a/docs/deprecations.md b/docs/deprecations.md index 8f51ee1ac46..7aa8a92195e 100644 --- a/docs/deprecations.md +++ b/docs/deprecations.md @@ -23,7 +23,6 @@ The following features are deprecated but have not yet been removed. |------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|-------------------------------------| | [Several fields of Task.Step are deprecated](https://github.com/tektoncd/pipeline/issues/4737) | v0.36.0 | Beta | Feb 25, 2023 | | [ClusterTask is deprecated](https://github.com/tektoncd/pipeline/issues/4476) | v0.41.0 | Beta | July 13, 2023 | -| [`pipelineRef.bundle` and `taskRef.bundle` are deprecated](https://github.com/tektoncd/pipeline/issues/5514) | v0.41.0 | Alpha | July 13, 2023 | | [The `config-trusted-resources` configMap is deprecated](https://github.com/tektoncd/pipeline/issues/5852) | v0.45.0 | Alpha | v0.46.0 | | [The `default-cloud-events-sink` setting in the `config-defaults` configMap is deprecated](https://github.com/tektoncd/pipeline/pull/6883) in favour of the new `config-events` configMap. | v0.50.0 | N/A | v0.59.0 | | [v1beta1 Tasks, TaskRuns, Pipelines, and PipelineRuns are deprecated in favor of v1](https://github.com/tektoncd/pipeline/issues/5541) | v0.50.0 | Beta | v0.62.0 | @@ -66,4 +65,4 @@ See [TEP-0074](https://github.com/tektoncd/community/blob/main/teps/0074-depreca - The generic pipelineResources functions including inputs and outputs resources and the `from` type -- [TaskRun.Status.ResourcesResult is deprecated and tombstoned #6301](https://github.com/tektoncd/pipeline/issues/6325) \ No newline at end of file +- [TaskRun.Status.ResourcesResult is deprecated and tombstoned #6301](https://github.com/tektoncd/pipeline/issues/6325) diff --git a/docs/migrating-v1beta1-to-v1.md b/docs/migrating-v1beta1-to-v1.md index badb5503b2f..925488d9135 100644 --- a/docs/migrating-v1beta1-to-v1.md +++ b/docs/migrating-v1beta1-to-v1.md @@ -50,6 +50,9 @@ In Tekton `v1`, the following fields have been changed: `PipelineResources` and the `resources` fields of Task, TaskRun, Pipeline and PipelineRun have been removed. Please use `Tasks` instead. For more information, see [Replacing PipelineResources](https://github.com/tektoncd/pipeline/blob/main/docs/pipelineresources.md) ## Replacing `taskRef.bundle` and `pipelineRef.bundle` with Bundle Resolver + +**Note: `taskRef.bundle` and `pipelineRef.bundle` are now removed from `v1beta1`. This is kept for "history" purposes**. + Bundle resolver in remote resolution should be used instead of `taskRun.spec.taskRef.bundle` and `pipelineRun.spec.pipelineRef.bundle`. The [`enable-bundles-resolver`](https://github.com/tektoncd/pipeline/blob/main/docs/install.md#customizing-the-pipelines-controller-behavior) feature flag must be enabled to use this feature. diff --git a/docs/pipelineruns.md b/docs/pipelineruns.md index 716bbb040b3..6507066cde7 100644 --- a/docs/pipelineruns.md +++ b/docs/pipelineruns.md @@ -158,10 +158,6 @@ A `Tekton Bundle` is an OCI artifact that contains Tekton resources like `Tasks` You can reference a `Tekton bundle` in a `TaskRef` in both `v1` and `v1beta1` using [remote resolution](./bundle-resolver.md#pipeline-resolution). The example syntax shown below for `v1` uses remote resolution and requires enabling [beta features](./additional-configs.md#beta-features). -In `v1beta1`, you can also reference a `Tekton bundle` using OCI bundle syntax, which has been deprecated in favor of remote resolution. The example shown below for `v1beta1` uses OCI bundle syntax, and requires enabling `enable-tekton-oci-bundles: "true"` feature flag. - -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} ```yaml spec: pipelineRef: @@ -174,17 +170,6 @@ spec: - name: kind value: Pipeline ``` -{{% /tab %}} - -{{% tab "v1beta1" %}} - ```yaml - spec: - pipelineRef: - name: mypipeline - bundle: docker.io/myrepo/mycatalog:v1.0 - ``` -{{% /tab %}} -{{< /tabs >}} The syntax and caveats are similar to using `Tekton Bundles` for `Task` references in [Pipelines](pipelines.md#tekton-bundles) or [TaskRuns](taskruns.md#tekton-bundles). diff --git a/docs/pipelines.md b/docs/pipelines.md index 12fafa422da..85793d46a1a 100644 --- a/docs/pipelines.md +++ b/docs/pipelines.md @@ -585,45 +585,24 @@ There is currently a hard limit of 20 objects in a bundle. You can reference a `Tekton bundle` in a `TaskRef` in both `v1` and `v1beta1` using [remote resolution](./bundle-resolver.md#pipeline-resolution). The example syntax shown below for `v1` uses remote resolution and requires enabling [beta features](./additional-configs.md#beta-features). -In `v1beta1`, you can also reference a `Tekton bundle` using OCI bundle syntax, which has been deprecated in favor of remote resolution. The example shown below for `v1beta1` uses OCI bundle syntax, and requires enabling `enable-tekton-oci-bundles: "true"` feature flag. - - -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} -```yaml -spec: - taskRef: - resolver: bundles - params: - - name: bundle - value: docker.io/myrepo/mycatalog - - name: name - value: echo-task - - name: kind - value: Task -``` -{{% /tab %}} - -{{% tab "v1beta1" %}} ```yaml spec: tasks: - name: hello-world - taskRef: - name: echo-task - bundle: docker.com/myrepo/mycatalog + taskRef: + resolver: bundles + params: + - name: bundle + value: docker.io/myrepo/mycatalog + - name: name + value: echo-task + - name: kind + value: Task ``` -{{% /tab %}} -{{< /tabs >}} - -Here, the `bundle` field is the full reference url to the artifact. The name is the -`metadata.name` field of the `Task`. You may also specify a `tag` as you would with a Docker image which will give you a fixed, repeatable reference to a `Task`. -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} ```yaml spec: taskRef: @@ -636,24 +615,9 @@ spec: - name: kind value: Task ``` -{{% /tab %}} - -{{% tab "v1beta1" %}} -```yaml -spec: - tasks: - - name: hello-world - taskRef: - name: echo-task - bundle: docker.com/myrepo/mycatalog:v1.0.1 -``` -{{% /tab %}} -{{< /tabs >}} You may also specify a fixed digest instead of a tag. -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} ```yaml spec: taskRef: @@ -666,19 +630,6 @@ spec: - name: kind value: Task ``` -{{% /tab %}} - -{{% tab "v1beta1" %}} -```yaml -spec: - tasks: - - name: hello-world - taskRef: - name: echo-task - bundle: docker.io/myrepo/mycatalog@sha256:abc123 -``` -{{% /tab %}} -{{< /tabs >}} Any of the above options will fetch the image using the `ImagePullSecrets` attached to the `ServiceAccount` specified in the `PipelineRun`. diff --git a/docs/taskruns.md b/docs/taskruns.md index ae93416eb5e..213454c1815 100644 --- a/docs/taskruns.md +++ b/docs/taskruns.md @@ -120,10 +120,6 @@ A `Tekton Bundle` is an OCI artifact that contains Tekton resources like `Tasks` You can reference a `Tekton bundle` in a `TaskRef` in both `v1` and `v1beta1` using [remote resolution](./bundle-resolver.md#pipeline-resolution). The example syntax shown below for `v1` uses remote resolution and requires enabling [beta features](./additional-configs.md#beta-features). -In `v1beta1`, you can also reference a `Tekton bundle` using OCI bundle syntax, which has been deprecated in favor of remote resolution. The example shown below for `v1beta1` uses OCI bundle syntax, and requires enabling `enable-tekton-oci-bundles: "true"` feature flag. - -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} ```yaml spec: taskRef: @@ -136,25 +132,9 @@ spec: - name: kind value: Task ``` -{{% /tab %}} - -{{% tab "v1beta1" %}} -```yaml -spec: -taskRef: - name: echo-task - bundle: docker.io/myrepo/mycatalog -``` -{{% /tab %}} -{{< /tabs >}} - -Here, the `bundle` field is the full reference url to the artifact. The name is the -`metadata.name` field of the `Task`. You may also specify a `tag` as you would with a Docker image which will give you a repeatable reference to a `Task`. -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} ```yaml spec: taskRef: @@ -167,22 +147,9 @@ spec: - name: kind value: Task ``` -{{% /tab %}} - -{{% tab "v1beta1" %}} -```yaml -spec: -taskRef: - name: echo-task - bundle: docker.io/myrepo/mycatalog:v1.0.1 -``` -{{% /tab %}} -{{< /tabs >}} You may also specify a fixed digest instead of a tag which ensures the referenced task is constant. -{{< tabs >}} -{{% tab "v1 & v1beta1" %}} ```yaml spec: taskRef: @@ -195,17 +162,6 @@ spec: - name: kind value: Task ``` -{{% /tab %}} - -{{% tab "v1beta1" %}} -```yaml -spec: -taskRef: - name: echo-task - bundle: docker.io/myrepo/mycatalog@sha256:abc123 -``` -{{% /tab %}} -{{< /tabs >}} A working example can be found [here](../examples/v1beta1/taskruns/no-ci/tekton-bundles.yaml). diff --git a/examples/v1beta1/taskruns/no-ci/tekton-bundles.yaml b/examples/v1beta1/taskruns/no-ci/tekton-bundles.yaml deleted file mode 100644 index ac659ad8520..00000000000 --- a/examples/v1beta1/taskruns/no-ci/tekton-bundles.yaml +++ /dev/null @@ -1,9 +0,0 @@ -# TODO: Move the example image to a tekton owned repo. -apiVersion: tekton.dev/v1beta1 -kind: TaskRun -metadata: - name: remote-task-reference -spec: - taskRef: - name: hello-world - bundle: docker.io/ptasci67/example-oci@sha256:053a6cb9f3711d4527dd0d37ac610e8727ec0288a898d5dfbd79b25bcaa29828 diff --git a/pkg/apis/pipeline/v1beta1/pipeline_types_test.go b/pkg/apis/pipeline/v1beta1/pipeline_types_test.go index d0dc19b4cdf..0ecb98cc00e 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_types_test.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_types_test.go @@ -506,39 +506,6 @@ func TestPipelineTask_ValidateCustomTask(t *testing.T) { } } -func TestPipelineTask_ValidateBundle_Failure(t *testing.T) { - tests := []struct { - name string - p PipelineTask - expectedError apis.FieldError - }{{ - name: "bundle - invalid reference", - p: PipelineTask{ - Name: "foo", - TaskRef: &TaskRef{Name: "bar", Bundle: "invalid reference"}, - }, - expectedError: *apis.ErrInvalidValue("invalid bundle reference (could not parse reference: invalid reference)", "taskRef.bundle"), - }, { - name: "bundle - missing taskRef name", - p: PipelineTask{ - Name: "foo", - TaskRef: &TaskRef{Bundle: "valid-bundle"}, - }, - expectedError: *apis.ErrMissingField("taskRef.name"), - }} - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := tt.p.validateBundle() - if err == nil { - t.Error("PipelineTask.ValidateBundles() did not return error for invalid bundle in a pipelineTask") - } - if d := cmp.Diff(tt.expectedError.Error(), err.Error(), cmpopts.IgnoreUnexported(apis.FieldError{})); d != "" { - t.Errorf("Pipeline.ValidateBundles() errors diff %s", diff.PrintWantGot(d)) - } - }) - } -} - func TestPipelineTask_ValidateRegularTask_Success(t *testing.T) { tests := []struct { name string @@ -593,13 +560,6 @@ func TestPipelineTask_ValidateRegularTask_Success(t *testing.T) { TaskRef: &TaskRef{ResolverRef: ResolverRef{Resolver: "bar", Params: Params{}}}, }, configMap: map[string]string{"enable-api-fields": "beta"}, - }, { - name: "pipeline task - use of bundle with the feature flag set", - tasks: PipelineTask{ - Name: "foo", - TaskRef: &TaskRef{Name: "bar", Bundle: "docker.io/foo"}, - }, - configMap: map[string]string{"enable-tekton-oci-bundles": "true"}, }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -647,13 +607,6 @@ func TestPipelineTask_ValidateRegularTask_Failure(t *testing.T) { Message: `missing field(s)`, Paths: []string{"taskRef.name"}, }, - }, { - name: "pipeline task - use of bundle without the feature flag set", - task: PipelineTask{ - Name: "foo", - TaskRef: &TaskRef{Name: "bar", Bundle: "docker.io/foo"}, - }, - expectedError: *apis.ErrGeneric("bundle requires \"enable-tekton-oci-bundles\" feature gate to be true but it is false"), }, { name: "pipeline task - taskRef with resolver and name", task: PipelineTask{ @@ -709,7 +662,8 @@ func TestPipelineTask_Validate_Failure(t *testing.T) { p: PipelineTask{Name: "foo", TaskSpec: &EmbeddedTask{ TypeMeta: runtime.TypeMeta{ APIVersion: "example.com", - }}}, + }, + }}, expectedError: *apis.ErrInvalidValue("custom task spec must specify kind", "taskSpec.kind"), }, { name: "custom task reference in taskref missing apiversion", @@ -720,19 +674,9 @@ func TestPipelineTask_Validate_Failure(t *testing.T) { p: PipelineTask{Name: "foo", TaskSpec: &EmbeddedTask{ TypeMeta: runtime.TypeMeta{ Kind: "Example", - }}}, + }, + }}, expectedError: *apis.ErrInvalidValue("custom task spec must specify apiVersion", "taskSpec.apiVersion"), - }, { - name: "invalid bundle without bundle name", - p: PipelineTask{ - Name: "invalid-bundle", - TaskRef: &TaskRef{Bundle: "bundle"}, - }, - expectedError: apis.FieldError{ - Message: `missing field(s)`, - Paths: []string{"taskRef.name"}, - }, - wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -788,35 +732,44 @@ func TestPipelineTaskList_Deps(t *testing.T) { }, }, { name: "valid pipeline with Task Results deps", - tasks: []PipelineTask{{ - Name: "task-1", - }, { - Name: "task-2", - Params: Params{{ - Value: ParamValue{ - Type: "string", - StringVal: "$(tasks.task-1.results.result)", - }}, - }}, + tasks: []PipelineTask{ + { + Name: "task-1", + }, { + Name: "task-2", + Params: Params{ + { + Value: ParamValue{ + Type: "string", + StringVal: "$(tasks.task-1.results.result)", + }, + }, + }, + }, }, expectedDeps: map[string][]string{ "task-2": {"task-1"}, }, }, { name: "valid pipeline with Task Results in Matrix deps", - tasks: []PipelineTask{{ - Name: "task-1", - }, { - Name: "task-2", - Matrix: &Matrix{ - Params: Params{{ - Value: ParamValue{ - Type: ParamTypeArray, - ArrayVal: []string{ - "$(tasks.task-1.results.result)", + tasks: []PipelineTask{ + { + Name: "task-1", + }, { + Name: "task-2", + Matrix: &Matrix{ + Params: Params{ + { + Value: ParamValue{ + Type: ParamTypeArray, + ArrayVal: []string{ + "$(tasks.task-1.results.result)", + }, + }, }, - }}, - }}}, + }, + }, + }, }, expectedDeps: map[string][]string{ "task-2": {"task-1"}, @@ -854,67 +807,38 @@ func TestPipelineTaskList_Validate(t *testing.T) { expectedError *apis.FieldError wc func(context.Context) context.Context }{{ - name: "validate all three valid custom task, bundle, and regular task", + name: "validate all valid custom task, and regular task", tasks: PipelineTaskList{{ Name: "valid-custom-task", TaskRef: &TaskRef{APIVersion: "example.com", Kind: "custom"}, - }, { - Name: "valid-bundle", - TaskRef: &TaskRef{Bundle: "bundle", Name: "bundle"}, }, { Name: "valid-task", TaskRef: &TaskRef{Name: "task"}, }}, path: "tasks", - wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }, { - name: "validate list of tasks with valid custom task and bundle but invalid regular task", + name: "validate list of tasks with valid custom task and invalid regular task", tasks: PipelineTaskList{{ Name: "valid-custom-task", TaskRef: &TaskRef{APIVersion: "example.com", Kind: "custom"}, - }, { - Name: "valid-bundle", - TaskRef: &TaskRef{Bundle: "bundle", Name: "bundle"}, }, { Name: "invalid-task-without-name", TaskRef: &TaskRef{Name: ""}, }}, path: "tasks", - expectedError: apis.ErrGeneric(`missing field(s)`, "tasks[2].taskRef.name"), - wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), - }, { - name: "validate list of tasks with valid custom task but invalid bundle and invalid regular task", - tasks: PipelineTaskList{{ - Name: "valid-custom-task", - TaskRef: &TaskRef{APIVersion: "example.com", Kind: "custom"}, - }, { - Name: "invalid-bundle", - TaskRef: &TaskRef{Bundle: "bundle"}, - }, { - Name: "invalid-task-without-name", - TaskRef: &TaskRef{Name: ""}, - }}, - path: "tasks", - expectedError: apis.ErrGeneric(`missing field(s)`, "tasks[2].taskRef.name").Also( - apis.ErrGeneric(`missing field(s)`, "tasks[1].taskRef.name")), - wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), + expectedError: apis.ErrGeneric(`missing field(s)`, "tasks[1].taskRef.name"), }, { - name: "validate all three invalid tasks - custom task, bundle and regular task", + name: "validate all invalid tasks - custom task and regular task", tasks: PipelineTaskList{{ Name: "invalid-custom-task", TaskRef: &TaskRef{APIVersion: "example.com"}, - }, { - Name: "invalid-bundle", - TaskRef: &TaskRef{Bundle: "bundle"}, }, { Name: "invalid-task", TaskRef: &TaskRef{Name: ""}, }}, path: "tasks", - expectedError: apis.ErrGeneric(`missing field(s)`, "tasks[2].taskRef.name").Also( - apis.ErrGeneric(`missing field(s)`, "tasks[1].taskRef.name")).Also( + expectedError: apis.ErrGeneric(`missing field(s)`, "tasks[1].taskRef.name").Also( apis.ErrGeneric(`invalid value: custom task ref must specify kind`, "tasks[0].taskRef.kind")), - wc: enableFeatures(t, []string{"enable-tekton-oci-bundles"}), }} for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -947,7 +871,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Matrix: &Matrix{ Params: Params{{ Name: "foobar", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"foo", "bar"}}, - }}}, + }}, + }, Params: Params{{ Name: "foobar", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"foo", "bar"}}, }}, @@ -958,12 +883,15 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { pt: &PipelineTask{ Name: "task", Matrix: &Matrix{ - Include: IncludeParamsList{{ - Name: "duplicate-param", - Params: Params{{ - Name: "duplicate", Value: ParamValue{Type: ParamTypeString, StringVal: "foo"}, - }}}, - }}, + Include: IncludeParamsList{ + { + Name: "duplicate-param", + Params: Params{{ + Name: "duplicate", Value: ParamValue{Type: ParamTypeString, StringVal: "foo"}, + }}, + }, + }, + }, Params: Params{{ Name: "duplicate", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"foo", "bar"}}, }}, @@ -978,7 +906,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Name: "foobar", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"foo", "bar"}}, }, { Name: "foobar", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"foo-1", "bar-1"}}, - }}}, + }}, + }, }, wantErrs: &apis.FieldError{ Message: `parameter names must be unique, the parameter "foobar" is also defined at`, @@ -991,7 +920,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Matrix: &Matrix{ Params: Params{{ Name: "foobar", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"foo", "bar"}}, - }}}, + }}, + }, Params: Params{{ Name: "barfoo", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"bar", "foo"}}, }}, @@ -1001,14 +931,17 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { pt: &PipelineTask{ Name: "task", Matrix: &Matrix{ - Include: IncludeParamsList{{ - Name: "invalid-include", - Params: Params{{ - Name: "foobar", Value: ParamValue{Type: ParamTypeString, StringVal: "foo"}, - }, { - Name: "foobar", Value: ParamValue{Type: ParamTypeString, StringVal: "foo-1"}, - }}}, - }}, + Include: IncludeParamsList{ + { + Name: "invalid-include", + Params: Params{{ + Name: "foobar", Value: ParamValue{Type: ParamTypeString, StringVal: "foo"}, + }, { + Name: "foobar", Value: ParamValue{Type: ParamTypeString, StringVal: "foo-1"}, + }}, + }, + }, + }, }, wantErrs: &apis.FieldError{ Message: `parameter names must be unique, the parameter "foobar" is also defined at`, @@ -1028,7 +961,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Name: "foo", Value: ParamValue{Type: ParamTypeString, StringVal: "$(params.foobar[*])"}, }, { Name: "bar", Value: ParamValue{Type: ParamTypeString, StringVal: "$(params.barfoo[*])"}, - }}}, + }}, + }, }, }, { name: "parameters in matrix contain result references", @@ -1037,7 +971,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Matrix: &Matrix{ Params: Params{{ Name: "a-param", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"$(tasks.foo-task.results.a-result)"}}, - }}}, + }}, + }, }, }, { name: "count of combinations of parameters in the matrix exceeds the maximum", @@ -1048,7 +983,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Name: "platform", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"linux", "mac", "windows"}}, }, { Name: "browser", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"chrome", "firefox", "safari"}}, - }}}, + }}, + }, }, wantErrs: &apis.FieldError{ Message: "expected 0 <= 9 <= 4", @@ -1063,7 +999,8 @@ func TestPipelineTask_ValidateMatrix(t *testing.T) { Name: "platform", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"linux", "mac"}}, }, { Name: "browser", Value: ParamValue{Type: ParamTypeArray, ArrayVal: []string{"chrome", "firefox"}}, - }}}, + }}, + }, }, }, { name: "valid matrix emitting string results consumed in aggregate by another pipelineTask", @@ -1236,7 +1173,8 @@ func TestPipelineTask_IsMatrixed(t *testing.T) { }, }, expected: true, - }, { + }, + { name: "matrixed with include", arg: arg{ Matrix: &Matrix{ @@ -1245,12 +1183,14 @@ func TestPipelineTask_IsMatrixed(t *testing.T) { Params: Params{{ Name: "IMAGE", Value: ParamValue{Type: ParamTypeString, StringVal: "image-1"}, }, { - Name: "DOCKERFILE", Value: ParamValue{Type: ParamTypeString, StringVal: "path/to/Dockerfile1"}}}, + Name: "DOCKERFILE", Value: ParamValue{Type: ParamTypeString, StringVal: "path/to/Dockerfile1"}, + }}, }}, }, }, expected: true, - }, { + }, + { name: "matrixed with params and include", arg: arg{ Matrix: &Matrix{ @@ -1260,7 +1200,8 @@ func TestPipelineTask_IsMatrixed(t *testing.T) { Include: IncludeParamsList{{ Name: "common-package", Params: Params{{ - Name: "package", Value: ParamValue{Type: ParamTypeString, StringVal: "path/to/common/package/"}}}, + Name: "package", Value: ParamValue{Type: ParamTypeString, StringVal: "path/to/common/package/"}, + }}, }}, }, }, @@ -1285,36 +1226,37 @@ func TestEmbeddedTask_IsCustomTask(t *testing.T) { name string et *EmbeddedTask want bool - }{{ - name: "not a custom task - APIVersion and Kind are not set", - et: &EmbeddedTask{}, - want: false, - }, { - name: "not a custom task - APIVersion is not set", - et: &EmbeddedTask{ - TypeMeta: runtime.TypeMeta{ - Kind: "Example", + }{ + { + name: "not a custom task - APIVersion and Kind are not set", + et: &EmbeddedTask{}, + want: false, + }, { + name: "not a custom task - APIVersion is not set", + et: &EmbeddedTask{ + TypeMeta: runtime.TypeMeta{ + Kind: "Example", + }, }, - }, - want: false, - }, { - name: "not a custom task - Kind is not set", - et: &EmbeddedTask{ - TypeMeta: runtime.TypeMeta{ - APIVersion: "example/v0", + want: false, + }, { + name: "not a custom task - Kind is not set", + et: &EmbeddedTask{ + TypeMeta: runtime.TypeMeta{ + APIVersion: "example/v0", + }, }, - }, - want: false, - }, { - name: "custom task - APIVersion and Kind are set", - et: &EmbeddedTask{ - TypeMeta: runtime.TypeMeta{ - Kind: "Example", - APIVersion: "example/v0", + want: false, + }, { + name: "custom task - APIVersion and Kind are set", + et: &EmbeddedTask{ + TypeMeta: runtime.TypeMeta{ + Kind: "Example", + APIVersion: "example/v0", + }, }, + want: true, }, - want: true, - }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -1334,7 +1276,8 @@ func TestPipelineChecksum(t *testing.T) { pipeline: &Pipeline{ TypeMeta: metav1.TypeMeta{ APIVersion: "tekton.dev/v1beta1", - Kind: "Pipeline"}, + Kind: "Pipeline", + }, ObjectMeta: metav1.ObjectMeta{ Name: "pipeline", Namespace: "pipeline-ns", @@ -1349,7 +1292,8 @@ func TestPipelineChecksum(t *testing.T) { pipeline: &Pipeline{ TypeMeta: metav1.TypeMeta{ APIVersion: "tekton.dev/v1beta1", - Kind: "Pipeline"}, + Kind: "Pipeline", + }, ObjectMeta: metav1.ObjectMeta{ Name: "pipeline", Namespace: "pipeline-ns", diff --git a/pkg/apis/pipeline/v1beta1/pipeline_validation.go b/pkg/apis/pipeline/v1beta1/pipeline_validation.go index 85d3312c596..c497e575741 100644 --- a/pkg/apis/pipeline/v1beta1/pipeline_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipeline_validation.go @@ -21,7 +21,6 @@ import ( "fmt" "strings" - "github.com/google/go-containerregistry/pkg/name" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/validate" "github.com/tektoncd/pipeline/pkg/internal/resultref" @@ -35,8 +34,10 @@ import ( "knative.dev/pkg/webhook/resourcesemantics" ) -var _ apis.Validatable = (*Pipeline)(nil) -var _ resourcesemantics.VerbLimited = (*Pipeline)(nil) +var ( + _ apis.Validatable = (*Pipeline)(nil) + _ resourcesemantics.VerbLimited = (*Pipeline)(nil) +) const ( taskRef = "taskRef" @@ -200,7 +201,6 @@ func (pt PipelineTask) Validate(ctx context.Context) (errs *apis.FieldError) { } } - cfg := config.FromContextOrDefaults(ctx) // Pipeline task having taskRef/taskSpec with APIVersion is classified as custom task switch { case pt.TaskRef != nil && !taskKinds[pt.TaskRef.Kind]: @@ -211,9 +211,6 @@ func (pt PipelineTask) Validate(ctx context.Context) (errs *apis.FieldError) { errs = errs.Also(pt.validateCustomTask()) case pt.TaskSpec != nil && pt.TaskSpec.APIVersion != "": errs = errs.Also(pt.validateCustomTask()) - // If EnableTektonOCIBundles feature flag is on, validate bundle specifications - case cfg.FeatureFlags.EnableTektonOCIBundles && pt.TaskRef != nil && pt.TaskRef.Bundle != "": - errs = errs.Also(pt.validateBundle()) default: errs = errs.Also(pt.validateTask(ctx)) } @@ -333,21 +330,6 @@ func (pt PipelineTask) validateCustomTask() (errs *apis.FieldError) { return errs } -// validateBundle validates bundle specifications - checking name and bundle -func (pt PipelineTask) validateBundle() (errs *apis.FieldError) { - // bundle requires a TaskRef to be specified - if (pt.TaskRef != nil && pt.TaskRef.Bundle != "") && pt.TaskRef.Name == "" { - errs = errs.Also(apis.ErrMissingField("taskRef.name")) - } - // If a bundle url is specified, ensure it is parsable - if pt.TaskRef != nil && pt.TaskRef.Bundle != "" { - if _, err := name.ParseReference(pt.TaskRef.Bundle); err != nil { - errs = errs.Also(apis.ErrInvalidValue(fmt.Sprintf("invalid bundle reference (%s)", err.Error()), "taskRef.bundle")) - } - } - return errs -} - // validateTask validates a pipeline task or a final task for taskRef and taskSpec func (pt PipelineTask) validateTask(ctx context.Context) (errs *apis.FieldError) { if pt.TaskSpec != nil { diff --git a/pkg/apis/pipeline/v1beta1/pipelineref_conversion.go b/pkg/apis/pipeline/v1beta1/pipelineref_conversion.go index ae794c8b738..efa399b6b85 100644 --- a/pkg/apis/pipeline/v1beta1/pipelineref_conversion.go +++ b/pkg/apis/pipeline/v1beta1/pipelineref_conversion.go @@ -23,14 +23,11 @@ import ( ) func (pr PipelineRef) convertTo(ctx context.Context, sink *v1.PipelineRef) { - if pr.Bundle == "" { - sink.Name = pr.Name - } + sink.Name = pr.Name sink.APIVersion = pr.APIVersion new := v1.ResolverRef{} pr.ResolverRef.convertTo(ctx, &new) sink.ResolverRef = new - pr.convertBundleToResolver(sink) } func (pr *PipelineRef) convertFrom(ctx context.Context, source v1.PipelineRef) { @@ -40,24 +37,3 @@ func (pr *PipelineRef) convertFrom(ctx context.Context, source v1.PipelineRef) { new.convertFrom(ctx, source.ResolverRef) pr.ResolverRef = new } - -// convertBundleToResolver converts v1beta1 bundle string to a remote reference with the bundle resolver in v1. -// The conversion from Resolver to Bundle is not being supported since remote resolution would be turned on by -// default and it will be in beta before the stored version of CRD getting swapped to v1. -func (pr PipelineRef) convertBundleToResolver(sink *v1.PipelineRef) { - if pr.Bundle != "" { - sink.ResolverRef = v1.ResolverRef{ - Resolver: "bundles", - Params: v1.Params{{ - Name: "bundle", - Value: v1.ParamValue{StringVal: pr.Bundle, Type: v1.ParamTypeString}, - }, { - Name: "name", - Value: v1.ParamValue{StringVal: pr.Name, Type: v1.ParamTypeString}, - }, { - Name: "kind", - Value: v1.ParamValue{StringVal: "Pipeline", Type: v1.ParamTypeString}, - }}, - } - } -} diff --git a/pkg/apis/pipeline/v1beta1/pipelineref_types.go b/pkg/apis/pipeline/v1beta1/pipelineref_types.go index ab943a3242f..8eb77c70d1b 100644 --- a/pkg/apis/pipeline/v1beta1/pipelineref_types.go +++ b/pkg/apis/pipeline/v1beta1/pipelineref_types.go @@ -23,11 +23,6 @@ type PipelineRef struct { // API version of the referent // +optional APIVersion string `json:"apiVersion,omitempty"` - // Bundle url reference to a Tekton Bundle. - // - // Deprecated: Please use ResolverRef with the bundles resolver instead. - // +optional - Bundle string `json:"bundle,omitempty"` // ResolverRef allows referencing a Pipeline in a remote location // like a git repo. This field is only supported when the alpha diff --git a/pkg/apis/pipeline/v1beta1/pipelineref_validation.go b/pkg/apis/pipeline/v1beta1/pipelineref_validation.go index 7131f6c62f5..a4336cf6be7 100644 --- a/pkg/apis/pipeline/v1beta1/pipelineref_validation.go +++ b/pkg/apis/pipeline/v1beta1/pipelineref_validation.go @@ -20,7 +20,6 @@ import ( "context" "fmt" - "github.com/google/go-containerregistry/pkg/name" "github.com/tektoncd/pipeline/pkg/apis/config" "knative.dev/pkg/apis" ) @@ -38,18 +37,12 @@ func (ref *PipelineRef) Validate(ctx context.Context) (errs *apis.FieldError) { if ref.Name != "" { errs = errs.Also(apis.ErrMultipleOneOf("name", "resolver")) } - if ref.Bundle != "" { - errs = errs.Also(apis.ErrMultipleOneOf("bundle", "resolver")) - } } if ref.Params != nil { errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "resolver params", config.BetaAPIFields).ViaField("params")) if ref.Name != "" { errs = errs.Also(apis.ErrMultipleOneOf("name", "params")) } - if ref.Bundle != "" { - errs = errs.Also(apis.ErrMultipleOneOf("bundle", "params")) - } if ref.Resolver == "" { errs = errs.Also(apis.ErrMissingField("resolver")) } @@ -59,12 +52,6 @@ func (ref *PipelineRef) Validate(ctx context.Context) (errs *apis.FieldError) { if ref.Name == "" { errs = errs.Also(apis.ErrMissingField("name")) } - if ref.Bundle != "" { - errs = errs.Also(validateBundleFeatureFlag(ctx, "bundle", true).ViaField("bundle")) - if _, err := name.ParseReference(ref.Bundle); err != nil { - errs = errs.Also(apis.ErrInvalidValue("invalid bundle reference", "bundle", err.Error())) - } - } } return //nolint:nakedret } diff --git a/pkg/apis/pipeline/v1beta1/pipelineref_validation_test.go b/pkg/apis/pipeline/v1beta1/pipelineref_validation_test.go index 82549d20ca9..b89569b09d5 100644 --- a/pkg/apis/pipeline/v1beta1/pipelineref_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelineref_validation_test.go @@ -38,28 +38,6 @@ func TestPipelineRef_Invalid(t *testing.T) { wantErr *apis.FieldError withContext func(context.Context) context.Context }{{ - name: "use of bundle without the feature flag set", - ref: &v1beta1.PipelineRef{ - Name: "my-pipeline", - Bundle: "docker.io/foo", - }, - wantErr: apis.ErrGeneric("bundle requires \"enable-tekton-oci-bundles\" feature gate to be true but it is false"), - }, { - name: "bundle missing name", - ref: &v1beta1.PipelineRef{ - Bundle: "docker.io/foo", - }, - wantErr: apis.ErrMissingField("name"), - withContext: enableTektonOCIBundles(t), - }, { - name: "invalid bundle reference", - ref: &v1beta1.PipelineRef{ - Name: "my-pipeline", - Bundle: "not a valid reference", - }, - wantErr: apis.ErrInvalidValue("invalid bundle reference", "bundle", "could not parse reference: not a valid reference"), - withContext: enableTektonOCIBundles(t), - }, { name: "pipelineRef without Pipeline Name", ref: &v1beta1.PipelineRef{}, wantErr: apis.ErrMissingField("name"), @@ -100,16 +78,6 @@ func TestPipelineRef_Invalid(t *testing.T) { }, wantErr: apis.ErrMultipleOneOf("name", "resolver"), withContext: cfgtesting.EnableBetaAPIFields, - }, { - name: "pipelineref resolver disallowed in conjunction with pipelineref bundle", - ref: &v1beta1.PipelineRef{ - Bundle: "foo", - ResolverRef: v1beta1.ResolverRef{ - Resolver: "baz", - }, - }, - wantErr: apis.ErrMultipleOneOf("bundle", "resolver"), - withContext: enableTektonOCIBundles(t), }, { name: "pipelineref params disallowed in conjunction with pipelineref name", ref: &v1beta1.PipelineRef{ @@ -126,22 +94,6 @@ func TestPipelineRef_Invalid(t *testing.T) { }, wantErr: apis.ErrMultipleOneOf("name", "params").Also(apis.ErrMissingField("resolver")), withContext: cfgtesting.EnableBetaAPIFields, - }, { - name: "pipelineref params disallowed in conjunction with pipelineref bundle", - ref: &v1beta1.PipelineRef{ - Bundle: "bar", - ResolverRef: v1beta1.ResolverRef{ - Params: v1beta1.Params{{ - Name: "foo", - Value: v1beta1.ParamValue{ - Type: v1beta1.ParamTypeString, - StringVal: "bar", - }, - }}, - }, - }, - wantErr: apis.ErrMultipleOneOf("bundle", "params").Also(apis.ErrMissingField("resolver")), - withContext: enableTektonOCIBundles(t), }} for _, tc := range tests { diff --git a/pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go index 04397c0708b..d0812253a8e 100644 --- a/pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/pipelinerun_conversion_test.go @@ -88,13 +88,14 @@ var ( }, }, }, - Sidecars: []v1beta1.SidecarState{{ContainerState: corev1.ContainerState{ - Terminated: &corev1.ContainerStateTerminated{ - ExitCode: 1, - Reason: "Error", - Message: "Error", + Sidecars: []v1beta1.SidecarState{{ + ContainerState: corev1.ContainerState{ + Terminated: &corev1.ContainerStateTerminated{ + ExitCode: 1, + Reason: "Error", + Message: "Error", + }, }, - }, Name: "error", ImageID: "image-id", ContainerName: "sidecar-error", @@ -268,17 +269,21 @@ func TestPipelineRunConversion(t *testing.T) { }, HostNetwork: false, }, - StepOverrides: []v1beta1.TaskRunStepOverride{{ - Name: "test-so", - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, - }}, + StepOverrides: []v1beta1.TaskRunStepOverride{ + { + Name: "test-so", + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, + }, + }, }, - SidecarOverrides: []v1beta1.TaskRunSidecarOverride{{ - Name: "test-so", - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, - }}, + SidecarOverrides: []v1beta1.TaskRunSidecarOverride{ + { + Name: "test-so", + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, + }, + }, }, Metadata: &v1beta1.PipelineTaskMetadata{ Labels: map[string]string{ @@ -315,7 +320,8 @@ func TestPipelineRunConversion(t *testing.T) { Value: *v1beta1.NewObject(map[string]string{ "pkey1": "val1", "pkey2": "rae", - })}, { + }), + }, { Name: "pipeline-result-2", Value: *v1beta1.NewObject(map[string]string{ "pkey1": "val2", @@ -460,38 +466,6 @@ func TestPipelineRunConversionFromDeprecated(t *testing.T) { }, }, }, - }, { - name: "bundle", - in: &v1beta1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.PipelineRunSpec{ - PipelineRef: &v1beta1.PipelineRef{ - Name: "test-bundle-name", - Bundle: "test-bundle", - }, - }, - }, - want: &v1beta1.PipelineRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.PipelineRunSpec{ - PipelineRef: &v1beta1.PipelineRef{ - ResolverRef: v1beta1.ResolverRef{ - Resolver: "bundles", - Params: v1beta1.Params{ - {Name: "bundle", Value: v1beta1.ParamValue{StringVal: "test-bundle", Type: "string"}}, - {Name: "name", Value: v1beta1.ParamValue{StringVal: "test-bundle-name", Type: "string"}}, - {Name: "kind", Value: v1beta1.ParamValue{StringVal: "Pipeline", Type: "string"}}, - }, - }, - }, - }, - }, }} for _, test := range tests { versions := []apis.Convertible{&v1.PipelineRun{}} diff --git a/pkg/apis/pipeline/v1beta1/taskref_conversion.go b/pkg/apis/pipeline/v1beta1/taskref_conversion.go index ab5f2a5614e..1b163970b31 100644 --- a/pkg/apis/pipeline/v1beta1/taskref_conversion.go +++ b/pkg/apis/pipeline/v1beta1/taskref_conversion.go @@ -23,15 +23,12 @@ import ( ) func (tr TaskRef) convertTo(ctx context.Context, sink *v1.TaskRef) { - if tr.Bundle == "" { - sink.Name = tr.Name - } + sink.Name = tr.Name sink.Kind = v1.TaskKind(tr.Kind) sink.APIVersion = tr.APIVersion new := v1.ResolverRef{} tr.ResolverRef.convertTo(ctx, &new) sink.ResolverRef = new - tr.convertBundleToResolver(sink) } // ConvertFrom converts v1beta1 TaskRef from v1 TaskRef @@ -43,24 +40,3 @@ func (tr *TaskRef) ConvertFrom(ctx context.Context, source v1.TaskRef) { new.convertFrom(ctx, source.ResolverRef) tr.ResolverRef = new } - -// convertBundleToResolver converts v1beta1 bundle string to a remote reference with the bundle resolver in v1. -// The conversion from Resolver to Bundle is not being supported since remote resolution would be turned on by -// default and it will be in beta before the stored version of CRD getting swapped to v1. -func (tr TaskRef) convertBundleToResolver(sink *v1.TaskRef) { - if tr.Bundle != "" { - sink.ResolverRef = v1.ResolverRef{ - Resolver: "bundles", - Params: v1.Params{{ - Name: "bundle", - Value: v1.ParamValue{StringVal: tr.Bundle, Type: v1.ParamTypeString}, - }, { - Name: "name", - Value: v1.ParamValue{StringVal: tr.Name, Type: v1.ParamTypeString}, - }, { - Name: "kind", - Value: v1.ParamValue{StringVal: "Task", Type: v1.ParamTypeString}, - }}, - } - } -} diff --git a/pkg/apis/pipeline/v1beta1/taskref_types.go b/pkg/apis/pipeline/v1beta1/taskref_types.go index f8f231cd961..336079fc24d 100644 --- a/pkg/apis/pipeline/v1beta1/taskref_types.go +++ b/pkg/apis/pipeline/v1beta1/taskref_types.go @@ -29,11 +29,6 @@ type TaskRef struct { // Note: A Task with non-empty APIVersion and Kind is considered a Custom Task // +optional APIVersion string `json:"apiVersion,omitempty"` - // Bundle url reference to a Tekton Bundle. - // - // Deprecated: Please use ResolverRef with the bundles resolver instead. - // +optional - Bundle string `json:"bundle,omitempty"` // ResolverRef allows referencing a Task in a remote location // like a git repo. This field is only supported when the alpha diff --git a/pkg/apis/pipeline/v1beta1/taskref_validation.go b/pkg/apis/pipeline/v1beta1/taskref_validation.go index a8bbe480ae8..05b811a4da5 100644 --- a/pkg/apis/pipeline/v1beta1/taskref_validation.go +++ b/pkg/apis/pipeline/v1beta1/taskref_validation.go @@ -20,7 +20,6 @@ import ( "context" "strings" - "github.com/google/go-containerregistry/pkg/name" "github.com/tektoncd/pipeline/pkg/apis/config" "k8s.io/apimachinery/pkg/util/validation" "knative.dev/pkg/apis" @@ -40,31 +39,17 @@ func (ref *TaskRef) Validate(ctx context.Context) (errs *apis.FieldError) { if ref.Name != "" { errs = errs.Also(apis.ErrMultipleOneOf("name", "resolver")) } - if ref.Bundle != "" { - errs = errs.Also(apis.ErrMultipleOneOf("bundle", "resolver")) - } } if ref.Params != nil { errs = errs.Also(config.ValidateEnabledAPIFields(ctx, "resolver params", config.BetaAPIFields).ViaField("params")) if ref.Name != "" { errs = errs.Also(apis.ErrMultipleOneOf("name", "params")) } - if ref.Bundle != "" { - errs = errs.Also(apis.ErrMultipleOneOf("bundle", "params")) - } if ref.Resolver == "" { errs = errs.Also(apis.ErrMissingField("resolver")) } errs = errs.Also(ValidateParameters(ctx, ref.Params)) } - case ref.Bundle != "": - if ref.Name == "" { - errs = errs.Also(apis.ErrMissingField("name")) - } - errs = errs.Also(validateBundleFeatureFlag(ctx, "bundle", true).ViaField("bundle")) - if _, err := name.ParseReference(ref.Bundle); err != nil { - errs = errs.Also(apis.ErrInvalidValue("invalid bundle reference", "bundle", err.Error())) - } default: if ref.Name == "" { errs = errs.Also(apis.ErrMissingField("name")) diff --git a/pkg/apis/pipeline/v1beta1/taskref_validation_test.go b/pkg/apis/pipeline/v1beta1/taskref_validation_test.go index 7d1f4f488ff..2935ab23410 100644 --- a/pkg/apis/pipeline/v1beta1/taskref_validation_test.go +++ b/pkg/apis/pipeline/v1beta1/taskref_validation_test.go @@ -60,12 +60,6 @@ func TestTaskRef_Valid(t *testing.T) { StringVal: "baz", }, }}}}, - }, { - name: "valid bundle", - taskRef: &v1beta1.TaskRef{ - Name: "bundled-task", - Bundle: "gcr.io/my-bundle"}, - wc: enableTektonOCIBundles(t), }} for _, ts := range tests { t.Run(ts.name, func(t *testing.T) { @@ -90,28 +84,6 @@ func TestTaskRef_Invalid(t *testing.T) { name: "missing taskref name", taskRef: &v1beta1.TaskRef{}, wantErr: apis.ErrMissingField("name"), - }, { - name: "use of bundle without the feature flag set", - taskRef: &v1beta1.TaskRef{ - Name: "my-task", - Bundle: "docker.io/foo", - }, - wantErr: apis.ErrGeneric("bundle requires \"enable-tekton-oci-bundles\" feature gate to be true but it is false"), - }, { - name: "bundle missing name", - taskRef: &v1beta1.TaskRef{ - Bundle: "docker.io/foo", - }, - wantErr: apis.ErrMissingField("name"), - wc: enableTektonOCIBundles(t), - }, { - name: "invalid bundle reference", - taskRef: &v1beta1.TaskRef{ - Name: "my-task", - Bundle: "invalid reference", - }, - wantErr: apis.ErrInvalidValue("invalid bundle reference", "bundle", "could not parse reference: invalid reference"), - wc: enableTektonOCIBundles(t), }, { name: "taskref params disallowed without resolver", taskRef: &v1beta1.TaskRef{ @@ -129,16 +101,6 @@ func TestTaskRef_Invalid(t *testing.T) { }, }, wantErr: apis.ErrMultipleOneOf("name", "resolver"), - }, { - name: "taskref resolver disallowed in conjunction with taskref bundle", - taskRef: &v1beta1.TaskRef{ - Bundle: "bar", - ResolverRef: v1beta1.ResolverRef{ - Resolver: "git", - }, - }, - wantErr: apis.ErrMultipleOneOf("bundle", "resolver"), - wc: enableTektonOCIBundles(t), }, { name: "taskref params disallowed in conjunction with taskref name", taskRef: &v1beta1.TaskRef{ @@ -154,22 +116,6 @@ func TestTaskRef_Invalid(t *testing.T) { }, }, wantErr: apis.ErrMultipleOneOf("name", "params").Also(apis.ErrMissingField("resolver")), - }, { - name: "taskref params disallowed in conjunction with taskref bundle", - taskRef: &v1beta1.TaskRef{ - Bundle: "bar", - ResolverRef: v1beta1.ResolverRef{ - Params: v1beta1.Params{{ - Name: "foo", - Value: v1beta1.ParamValue{ - Type: v1beta1.ParamTypeString, - StringVal: "bar", - }, - }}, - }, - }, - wantErr: apis.ErrMultipleOneOf("bundle", "params").Also(apis.ErrMissingField("resolver")), - wc: enableTektonOCIBundles(t), }, { name: "invalid taskref name", taskRef: &v1beta1.TaskRef{Name: "_foo"}, diff --git a/pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go b/pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go index b9e1565dda9..9bf4eae0cda 100644 --- a/pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/taskrun_conversion_test.go @@ -50,296 +50,307 @@ func TestTaskRunConversion(t *testing.T) { tests := []struct { name string in *v1beta1.TaskRun - }{{ - name: "simple taskrun", - in: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.TaskRunSpec{ - TaskRef: &v1beta1.TaskRef{Name: "test-task"}, - }, - }, - }, { - name: "taskrun conversion deprecated step fields", - in: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.TaskRunSpec{ - TaskSpec: &v1beta1.TaskSpec{ - Steps: []v1beta1.Step{{ - DeprecatedLivenessProbe: &corev1.Probe{InitialDelaySeconds: 1}, - DeprecatedReadinessProbe: &corev1.Probe{InitialDelaySeconds: 2}, - DeprecatedPorts: []corev1.ContainerPort{{Name: "port"}}, - DeprecatedStartupProbe: &corev1.Probe{InitialDelaySeconds: 3}, - DeprecatedLifecycle: &corev1.Lifecycle{PostStart: &corev1.LifecycleHandler{Exec: &corev1.ExecAction{ - Command: []string{"lifecycle command"}, - }}}, - DeprecatedTerminationMessagePath: "path", - DeprecatedTerminationMessagePolicy: corev1.TerminationMessagePolicy("policy"), - DeprecatedStdin: true, - DeprecatedStdinOnce: true, - DeprecatedTTY: true, - }}, - StepTemplate: &v1beta1.StepTemplate{ - DeprecatedName: "name", - DeprecatedLivenessProbe: &corev1.Probe{InitialDelaySeconds: 1}, - DeprecatedReadinessProbe: &corev1.Probe{InitialDelaySeconds: 2}, - DeprecatedPorts: []corev1.ContainerPort{{Name: "port"}}, - DeprecatedStartupProbe: &corev1.Probe{InitialDelaySeconds: 3}, - DeprecatedLifecycle: &corev1.Lifecycle{PostStart: &corev1.LifecycleHandler{Exec: &corev1.ExecAction{ - Command: []string{"lifecycle command"}, - }}}, - DeprecatedTerminationMessagePath: "path", - DeprecatedTerminationMessagePolicy: corev1.TerminationMessagePolicy("policy"), - DeprecatedStdin: true, - DeprecatedStdinOnce: true, - DeprecatedTTY: true, + }{ + { + name: "simple taskrun", + in: &v1beta1.TaskRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "bar", + }, + Spec: v1beta1.TaskRunSpec{ + TaskRef: &v1beta1.TaskRef{Name: "test-task"}, + }, + }, + }, { + name: "taskrun conversion deprecated step fields", + in: &v1beta1.TaskRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "bar", + }, + Spec: v1beta1.TaskRunSpec{ + TaskSpec: &v1beta1.TaskSpec{ + Steps: []v1beta1.Step{{ + DeprecatedLivenessProbe: &corev1.Probe{InitialDelaySeconds: 1}, + DeprecatedReadinessProbe: &corev1.Probe{InitialDelaySeconds: 2}, + DeprecatedPorts: []corev1.ContainerPort{{Name: "port"}}, + DeprecatedStartupProbe: &corev1.Probe{InitialDelaySeconds: 3}, + DeprecatedLifecycle: &corev1.Lifecycle{PostStart: &corev1.LifecycleHandler{Exec: &corev1.ExecAction{ + Command: []string{"lifecycle command"}, + }}}, + DeprecatedTerminationMessagePath: "path", + DeprecatedTerminationMessagePolicy: corev1.TerminationMessagePolicy("policy"), + DeprecatedStdin: true, + DeprecatedStdinOnce: true, + DeprecatedTTY: true, + }}, + StepTemplate: &v1beta1.StepTemplate{ + DeprecatedName: "name", + DeprecatedLivenessProbe: &corev1.Probe{InitialDelaySeconds: 1}, + DeprecatedReadinessProbe: &corev1.Probe{InitialDelaySeconds: 2}, + DeprecatedPorts: []corev1.ContainerPort{{Name: "port"}}, + DeprecatedStartupProbe: &corev1.Probe{InitialDelaySeconds: 3}, + DeprecatedLifecycle: &corev1.Lifecycle{PostStart: &corev1.LifecycleHandler{Exec: &corev1.ExecAction{ + Command: []string{"lifecycle command"}, + }}}, + DeprecatedTerminationMessagePath: "path", + DeprecatedTerminationMessagePolicy: corev1.TerminationMessagePolicy("policy"), + DeprecatedStdin: true, + DeprecatedStdinOnce: true, + DeprecatedTTY: true, + }, }, }, }, - }, - }, { - name: "taskrun with step Results in step state", - in: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.TaskRunSpec{}, - Status: v1beta1.TaskRunStatus{ - TaskRunStatusFields: v1beta1.TaskRunStatusFields{ - Steps: []v1beta1.StepState{{ - Results: []v1beta1.TaskRunStepResult{{ - Name: "foo", - Type: v1beta1.ResultsTypeString, - Value: v1beta1.ResultValue{ - Type: v1beta1.ParamTypeString, - StringVal: "bar", - }, + }, { + name: "taskrun with step Results in step state", + in: &v1beta1.TaskRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "bar", + }, + Spec: v1beta1.TaskRunSpec{}, + Status: v1beta1.TaskRunStatus{ + TaskRunStatusFields: v1beta1.TaskRunStatusFields{ + Steps: []v1beta1.StepState{{ + Results: []v1beta1.TaskRunStepResult{{ + Name: "foo", + Type: v1beta1.ResultsTypeString, + Value: v1beta1.ResultValue{ + Type: v1beta1.ParamTypeString, + StringVal: "bar", + }, + }}, }}, - }}, - }, - }, - }, - }, { - name: "taskrun conversion all non deprecated fields", - in: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.TaskRunSpec{ - Debug: &v1beta1.TaskRunDebug{ - Breakpoints: &v1beta1.TaskBreakpoints{ - OnFailure: "enabled", }, }, - Params: v1beta1.Params{{ - Name: "param-task-1", - Value: v1beta1.ParamValue{ - ArrayVal: []string{"value-task-1"}, - Type: "string", - }, - }}, - ServiceAccountName: "test-sa", - TaskRef: &v1beta1.TaskRef{Name: "test-task"}, - TaskSpec: &v1beta1.TaskSpec{ - Params: []v1beta1.ParamSpec{{ - Name: "param-name", - Type: "string", - }}, + }, + }, { + name: "taskrun conversion all non deprecated fields", + in: &v1beta1.TaskRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "bar", }, - Status: "test-task-run-spec-status", - StatusMessage: v1beta1.TaskRunSpecStatusMessage("test-status-message"), - Timeout: &metav1.Duration{Duration: 5 * time.Second}, - PodTemplate: &pod.Template{ - NodeSelector: map[string]string{ - "label": "value", + Spec: v1beta1.TaskRunSpec{ + Debug: &v1beta1.TaskRunDebug{ + Breakpoints: &v1beta1.TaskBreakpoints{ + OnFailure: "enabled", + }, }, - }, - Workspaces: []v1beta1.WorkspaceBinding{{ - Name: "workspace-volumeclaimtemplate", - SubPath: "/foo/bar/baz", - VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ - ObjectMeta: metav1.ObjectMeta{ - Name: "pvc", + Params: v1beta1.Params{{ + Name: "param-task-1", + Value: v1beta1.ParamValue{ + ArrayVal: []string{"value-task-1"}, + Type: "string", }, - Spec: corev1.PersistentVolumeClaimSpec{}, + }}, + ServiceAccountName: "test-sa", + TaskRef: &v1beta1.TaskRef{Name: "test-task"}, + TaskSpec: &v1beta1.TaskSpec{ + Params: []v1beta1.ParamSpec{{ + Name: "param-name", + Type: "string", + }}, }, - }, { - Name: "workspace-pvc", - PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{}, - }, { - Name: "workspace-emptydir", - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, { - Name: "workspace-configmap", - ConfigMap: &corev1.ConfigMapVolumeSource{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: "configbar", + Status: "test-task-run-spec-status", + StatusMessage: v1beta1.TaskRunSpecStatusMessage("test-status-message"), + Timeout: &metav1.Duration{Duration: 5 * time.Second}, + PodTemplate: &pod.Template{ + NodeSelector: map[string]string{ + "label": "value", }, }, - }, { - Name: "workspace-secret", - Secret: &corev1.SecretVolumeSource{SecretName: "sname"}, - }, { - Name: "workspace-projected", - Projected: &corev1.ProjectedVolumeSource{ - Sources: []corev1.VolumeProjection{{ - ConfigMap: &corev1.ConfigMapProjection{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: "projected-configmap", + Workspaces: []v1beta1.WorkspaceBinding{ + { + Name: "workspace-volumeclaimtemplate", + SubPath: "/foo/bar/baz", + VolumeClaimTemplate: &corev1.PersistentVolumeClaim{ + ObjectMeta: metav1.ObjectMeta{ + Name: "pvc", }, + Spec: corev1.PersistentVolumeClaimSpec{}, }, - Secret: &corev1.SecretProjection{ + }, { + Name: "workspace-pvc", + PersistentVolumeClaim: &corev1.PersistentVolumeClaimVolumeSource{}, + }, { + Name: "workspace-emptydir", + EmptyDir: &corev1.EmptyDirVolumeSource{}, + }, { + Name: "workspace-configmap", + ConfigMap: &corev1.ConfigMapVolumeSource{ LocalObjectReference: corev1.LocalObjectReference{ - Name: "projected-secret", + Name: "configbar", }, }, - ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ - Audience: "projected-sat", + }, { + Name: "workspace-secret", + Secret: &corev1.SecretVolumeSource{SecretName: "sname"}, + }, { + Name: "workspace-projected", + Projected: &corev1.ProjectedVolumeSource{ + Sources: []corev1.VolumeProjection{{ + ConfigMap: &corev1.ConfigMapProjection{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "projected-configmap", + }, + }, + Secret: &corev1.SecretProjection{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: "projected-secret", + }, + }, + ServiceAccountToken: &corev1.ServiceAccountTokenProjection{ + Audience: "projected-sat", + }, + }}, + }, + }, { + Name: "workspace-csi", + CSI: &corev1.CSIVolumeSource{ + NodePublishSecretRef: &corev1.LocalObjectReference{ + Name: "projected-csi", + }, + VolumeAttributes: map[string]string{"key": "attribute-val"}, }, - }}, - }, - }, { - Name: "workspace-csi", - CSI: &corev1.CSIVolumeSource{ - NodePublishSecretRef: &corev1.LocalObjectReference{ - Name: "projected-csi", }, - VolumeAttributes: map[string]string{"key": "attribute-val"}, }, - }, - }, - StepOverrides: []v1beta1.TaskRunStepOverride{{ - Name: "task-1", - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, - }}, - }, - SidecarOverrides: []v1beta1.TaskRunSidecarOverride{{ - Name: "task-1", - Resources: corev1.ResourceRequirements{ - Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, - }}, - }, - ComputeResources: &corev1.ResourceRequirements{ - Requests: corev1.ResourceList{ - corev1.ResourceMemory: corev1resources.MustParse("1Gi"), + StepOverrides: []v1beta1.TaskRunStepOverride{ + { + Name: "task-1", + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, + }, + }, }, - }, - }, - Status: v1beta1.TaskRunStatus{ - Status: duckv1.Status{ - Conditions: []apis.Condition{ + SidecarOverrides: []v1beta1.TaskRunSidecarOverride{ { - Type: apis.ConditionSucceeded, - Status: corev1.ConditionTrue, - Reason: "Completed", - Message: "All tasks finished running", + Name: "task-1", + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{corev1.ResourceMemory: corev1resources.MustParse("1Gi")}, + }, + }, + }, + ComputeResources: &corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceMemory: corev1resources.MustParse("1Gi"), }, }, - ObservedGeneration: 1, }, - TaskRunStatusFields: v1beta1.TaskRunStatusFields{ - PodName: "pod-name", - StartTime: &metav1.Time{Time: time.Now()}, - CompletionTime: &metav1.Time{Time: time.Now().Add(1 * time.Minute)}, - Steps: []v1beta1.StepState{{ - ContainerState: corev1.ContainerState{ - Terminated: &corev1.ContainerStateTerminated{ - ExitCode: 123, - }}, + Status: v1beta1.TaskRunStatus{ + Status: duckv1.Status{ + Conditions: []apis.Condition{ + { + Type: apis.ConditionSucceeded, + Status: corev1.ConditionTrue, + Reason: "Completed", + Message: "All tasks finished running", + }, + }, + ObservedGeneration: 1, + }, + TaskRunStatusFields: v1beta1.TaskRunStatusFields{ + PodName: "pod-name", + StartTime: &metav1.Time{Time: time.Now()}, + CompletionTime: &metav1.Time{Time: time.Now().Add(1 * time.Minute)}, + Steps: []v1beta1.StepState{{ + ContainerState: corev1.ContainerState{ + Terminated: &corev1.ContainerStateTerminated{ + ExitCode: 123, + }, + }, - Name: "failure", - ContainerName: "step-failure", - ImageID: "image-id", - }}, - Sidecars: []v1beta1.SidecarState{{ - ContainerState: corev1.ContainerState{ - Terminated: &corev1.ContainerStateTerminated{ - ExitCode: 123, - }}, + Name: "failure", + ContainerName: "step-failure", + ImageID: "image-id", + }}, + Sidecars: []v1beta1.SidecarState{{ + ContainerState: corev1.ContainerState{ + Terminated: &corev1.ContainerStateTerminated{ + ExitCode: 123, + }, + }, - Name: "failure", - ContainerName: "step-failure", - ImageID: "image-id", - }}, - RetriesStatus: []v1beta1.TaskRunStatus{{ - Status: duckv1.Status{ - Conditions: []apis.Condition{{ - Type: apis.ConditionSucceeded, - Status: corev1.ConditionFalse, - }}, - }, - }}, - TaskRunResults: []v1beta1.TaskRunResult{{ - Name: "resultName", - Type: v1beta1.ResultsTypeObject, - Value: *v1beta1.NewObject(map[string]string{"hello": "world"}), - }}, - TaskSpec: &v1beta1.TaskSpec{ - Description: "test", - Steps: []v1beta1.Step{{ - Image: "foo", + Name: "failure", + ContainerName: "step-failure", + ImageID: "image-id", }}, - Volumes: []corev1.Volume{{}}, - Params: []v1beta1.ParamSpec{{ - Name: "param-1", - Type: v1beta1.ParamTypeString, - Description: "My first param", + RetriesStatus: []v1beta1.TaskRunStatus{{ + Status: duckv1.Status{ + Conditions: []apis.Condition{{ + Type: apis.ConditionSucceeded, + Status: corev1.ConditionFalse, + }}, + }, }}, - }, - Provenance: &v1beta1.Provenance{ - RefSource: &v1beta1.RefSource{ - URI: "test-uri", - Digest: map[string]string{"sha256": "digest"}, + TaskRunResults: []v1beta1.TaskRunResult{{ + Name: "resultName", + Type: v1beta1.ResultsTypeObject, + Value: *v1beta1.NewObject(map[string]string{"hello": "world"}), + }}, + TaskSpec: &v1beta1.TaskSpec{ + Description: "test", + Steps: []v1beta1.Step{{ + Image: "foo", + }}, + Volumes: []corev1.Volume{{}}, + Params: []v1beta1.ParamSpec{{ + Name: "param-1", + Type: v1beta1.ParamTypeString, + Description: "My first param", + }}, }, - FeatureFlags: config.DefaultFeatureFlags.DeepCopy(), - }}, - }, - }, - }, { - name: "taskrun with stepArtifacts in step state", - in: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", + Provenance: &v1beta1.Provenance{ + RefSource: &v1beta1.RefSource{ + URI: "test-uri", + Digest: map[string]string{"sha256": "digest"}, + }, + FeatureFlags: config.DefaultFeatureFlags.DeepCopy(), + }, + }, + }, }, - Spec: v1beta1.TaskRunSpec{}, - Status: v1beta1.TaskRunStatus{ - TaskRunStatusFields: v1beta1.TaskRunStatusFields{ - Steps: []v1beta1.StepState{{ - Inputs: []v1beta1.TaskRunStepArtifact{{ - Name: "Input", - Values: []v1beta1.ArtifactValue{ - {Uri: "git:example.com", - Digest: map[v1beta1.Algorithm]string{ - "sha256": "49149151d283ac77d3fd4594825242f076c999903261bd95f79a8b261811c11a", - "sha1": "22b80854ba81d11d980794952f2343fedf2189d5", + }, { + name: "taskrun with stepArtifacts in step state", + in: &v1beta1.TaskRun{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "bar", + }, + Spec: v1beta1.TaskRunSpec{}, + Status: v1beta1.TaskRunStatus{ + TaskRunStatusFields: v1beta1.TaskRunStatusFields{ + Steps: []v1beta1.StepState{{ + Inputs: []v1beta1.TaskRunStepArtifact{{ + Name: "Input", + Values: []v1beta1.ArtifactValue{ + { + Uri: "git:example.com", + Digest: map[v1beta1.Algorithm]string{ + "sha256": "49149151d283ac77d3fd4594825242f076c999903261bd95f79a8b261811c11a", + "sha1": "22b80854ba81d11d980794952f2343fedf2189d5", + }, }, }, - }, - }}, - Outputs: []v1beta1.TaskRunStepArtifact{{ - Name: "Output", - Values: []v1beta1.ArtifactValue{ - {Uri: "docker:example.aaa/bbb:latest", - Digest: map[v1beta1.Algorithm]string{ - "sha256": "f05a847a269ccafc90af40ad55aedef62d165227475e4d95ef6812f7c5daa21a", + }}, + Outputs: []v1beta1.TaskRunStepArtifact{{ + Name: "Output", + Values: []v1beta1.ArtifactValue{ + { + Uri: "docker:example.aaa/bbb:latest", + Digest: map[v1beta1.Algorithm]string{ + "sha256": "f05a847a269ccafc90af40ad55aedef62d165227475e4d95ef6812f7c5daa21a", + }, }, }, - }, + }}, }}, - }}, + }, }, }, }, - }, } for _, test := range tests { @@ -510,37 +521,6 @@ func TestTaskRunConversionFromDeprecated(t *testing.T) { }, }, }, - }}, - }, { - name: "bundle", - in: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.TaskRunSpec{ - TaskRef: &v1beta1.TaskRef{ - Name: "test-bundle-name", - Bundle: "test-bundle", - }, - }, - }, - want: &v1beta1.TaskRun{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "bar", - }, - Spec: v1beta1.TaskRunSpec{ - TaskRef: &v1beta1.TaskRef{ - ResolverRef: v1beta1.ResolverRef{ - Resolver: "bundles", - Params: v1beta1.Params{ - {Name: "bundle", Value: v1beta1.ParamValue{StringVal: "test-bundle", Type: "string"}}, - {Name: "name", Value: v1beta1.ParamValue{StringVal: "test-bundle-name", Type: "string"}}, - {Name: "kind", Value: v1beta1.ParamValue{StringVal: "Task", Type: "string"}}, - }, - }, - }, }, }, }, { @@ -748,7 +728,8 @@ func TestTaskRunConvertTo(t *testing.T) { }}, }, }, - }}} + }, + }} for _, test := range tests { versions := []apis.Convertible{&v1.TaskRun{}} for _, version := range versions { @@ -813,7 +794,8 @@ func TestTaskRunConvertFrom(t *testing.T) { }}, }, }, - }}} + }, + }} for _, test := range tests { versions := []apis.Convertible{&v1beta1.TaskRun{}} for _, version := range versions {