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/pipeline-api.md b/docs/pipeline-api.md index 4bee675fe6d..24d158b119b 100644 --- a/docs/pipeline-api.md +++ b/docs/pipeline-api.md @@ -10738,19 +10738,6 @@ string -bundle
- -string - - - -(Optional) -

Bundle url reference to a Tekton Bundle.

-

Deprecated: Please use ResolverRef with the bundles resolver instead.

- - - - ResolverRef
@@ -14290,19 +14277,6 @@ Note: A Task with non-empty APIVersion and Kind is considered a Custom Task

-bundle
- -string - - - -(Optional) -

Bundle url reference to a Tekton Bundle.

-

Deprecated: Please use ResolverRef with the bundles resolver instead.

- - - - ResolverRef
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/go.mod b/go.mod index 1f2b20da781..baff01ab376 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/tektoncd/pipeline -go 1.19 +go 1.21 + +toolchain go1.21.7 require ( github.com/Microsoft/go-winio v0.6.1 // indirect diff --git a/go.sum b/go.sum index b0c7cc11735..fa25bc423e3 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,7 @@ cloud.google.com/go v0.79.0/go.mod h1:3bzgcEeQlzbuEAYu4mrWhKqWjmpprinYgKJLgKHnbb cloud.google.com/go v0.81.0/go.mod h1:mk/AM35KwGk/Nm2YSeZbxXdrNK3KZOYHmLkOqC2V6E0= cloud.google.com/go v0.83.0/go.mod h1:Z7MJUsANfY0pYPdw0lbnivPx4/vhy/e2FEkSkF7vAVY= cloud.google.com/go v0.112.0 h1:tpFCD7hpHFlQ8yPwT3x+QeXqc2T6+n6T+hmABHfDUSM= +cloud.google.com/go v0.112.0/go.mod h1:3jEEVwZ/MHU4djK5t5RHuKOA/GbLddgTdVubX1qnPD4= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -140,6 +141,7 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= @@ -152,6 +154,7 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.50.25 h1:vhiHtLYybv1Nhx3Kv18BBC6L0aPJHaG9aeEsr92W99c= +github.com/aws/aws-sdk-go v1.50.25/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk= github.com/aws/aws-sdk-go-v2 v1.18.0/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= github.com/aws/aws-sdk-go-v2 v1.25.2 h1:/uiG1avJRgLGiQM9X3qJM8+Qa6KRGK5rRPuXE0HUM+w= github.com/aws/aws-sdk-go-v2 v1.25.2/go.mod h1:Evoc5AsmtveRt1komDwIsjHFyrP5tDuF1D1U+6z6pNo= @@ -258,6 +261,7 @@ github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa h1:jQCWAUqqlij9Pgj2i/PB79y4KOPYVyFYdROxgaCwdTQ= +github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq8dk6e9PdstVsDgu9RuyIIJqAaF//0IM= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= @@ -390,6 +394,7 @@ github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= +github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/cli v20.10.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1xfI36MSkFg= github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= @@ -419,6 +424,7 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v2.9.5+incompatible/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful/v3 v3.8.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= @@ -439,6 +445,7 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= +github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= @@ -461,6 +468,7 @@ github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2H github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0= github.com/gliderlabs/ssh v0.3.5 h1:OcaySEmAQJgyYcArR+gGGTHCyE7nvhEMTlYY+Dp8CpY= +github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4= github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI= github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= @@ -468,6 +476,7 @@ github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmS github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= github.com/go-git/go-git/v5 v5.11.0 h1:XIZc1p+8YzypNr34itUfSvYJcv+eYdTnTvOZ2vD3cA4= github.com/go-git/go-git/v5 v5.11.0/go.mod h1:6GFcX2P3NM7FPBfpePbpLd21XxsgdAt+lKqXmCUiUCY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= @@ -514,6 +523,7 @@ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+ github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= +github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= github.com/gobuffalo/flect v0.2.4 h1:BSYA8+T60cdyq+vynaSUjqSVI9mDEg9ZfQUXKmfjo4I= github.com/gobuffalo/flect v0.2.4/go.mod h1:1ZyCLIbg0YD7sDkzvFdPoOydPtD8y9JQnrOROolUcM8= github.com/goccy/kpoward v0.1.0 h1:UcrLMG9rq7NwrMiUc0h+qUyIlvqPzqLiPb+zQEqH8cE= @@ -667,6 +677,7 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 h1:Wqo399gCIufwto+VfwCSvsnfGpF/w5E9CNxSwbpD6No= github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0/go.mod h1:qmOFXW2epJhM0qSnUUYpldc7gVz2KMQwJ/QYCDIa7XU= github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw= +github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -678,6 +689,7 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs= +github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= @@ -747,6 +759,7 @@ github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHW github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/clock v1.2.0 h1:eq4kys+NI0PLngzaHEe7AmPT90XMGIEySD1JfV1PDIs= +github.com/jmhodges/clock v1.2.0/go.mod h1:qKjhA7x7u/lQpPB1XAqX1b1lCI/w3/fNuYpI/ZjLynI= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= @@ -787,6 +800,7 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= @@ -898,6 +912,7 @@ github.com/onsi/gomega v1.21.1/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8lu github.com/onsi/gomega v1.22.1/go.mod h1:x6n7VNe4hw0vkyYUM4mjIXx3JbLiPaBPNgB7PRQ1tuM= github.com/onsi/gomega v1.23.0/go.mod h1:Z/NWtiqwBrwUt4/2loMmHL63EDLnYHmVbuBpDr2vQAg= github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= github.com/opencontainers/go-digest v0.0.0-20170106003457-a6d0ee40d420/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v0.0.0-20180430190053-c9281466c8b2/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= @@ -997,6 +1012,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -1117,6 +1133,7 @@ github.com/urfave/cli v1.22.2/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtX github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/vbatts/tar-split v0.11.3 h1:hLFqsOLQ1SsppQNTMpkpPXClLDfC2A3Zgy9OUU+RVck= github.com/vbatts/tar-split v0.11.3/go.mod h1:9QlHN18E+fEH7RdG+QAJJcuya3rqT7eXSTY7wGrAokY= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= @@ -1195,6 +1212,7 @@ go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0 go.uber.org/automaxprocs v1.4.0 h1:CpDZl6aOlLhReez+8S3eEotD7Jx0Os++lemPlMULQP0= go.uber.org/automaxprocs v1.4.0/go.mod h1:/mTEdr7LvHhs0v7mjdxDreTz1OG5zdZGqgOnhWiR/+Q= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ= @@ -1748,6 +1766,7 @@ gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKW gopkg.in/go-jose/go-jose.v2 v2.6.1 h1:qEzJlIDmG9q5VO0M/o8tGS65QMHMS1w01TQJB1VPJ4U= gopkg.in/go-jose/go-jose.v2 v2.6.1/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI= gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY= +gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -1785,6 +1804,7 @@ gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81 gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.0.3/go.mod h1:Z7Lb0S5l+klDB31fvDQX8ss/FlKDxtlFlw3Oa8Ymbl8= gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk= +gotest.tools/v3 v3.1.0/go.mod h1:fHy7eyTmJFO5bQbUsEGQ1v4m2J3Jz9eWL54TP2/ZuYQ= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/pkg/apis/pipeline/v1beta1/openapi_generated.go b/pkg/apis/pipeline/v1beta1/openapi_generated.go index 75817a84c3a..4a029049846 100644 --- a/pkg/apis/pipeline/v1beta1/openapi_generated.go +++ b/pkg/apis/pipeline/v1beta1/openapi_generated.go @@ -1645,13 +1645,6 @@ func schema_pkg_apis_pipeline_v1beta1_PipelineRef(ref common.ReferenceCallback) Format: "", }, }, - "bundle": { - SchemaProps: spec.SchemaProps{ - Description: "Bundle url reference to a Tekton Bundle.\n\nDeprecated: Please use ResolverRef with the bundles resolver instead.", - Type: []string{"string"}, - Format: "", - }, - }, }, }, }, @@ -4558,13 +4551,6 @@ func schema_pkg_apis_pipeline_v1beta1_TaskRef(ref common.ReferenceCallback) comm Format: "", }, }, - "bundle": { - SchemaProps: spec.SchemaProps{ - Description: "Bundle url reference to a Tekton Bundle.\n\nDeprecated: Please use ResolverRef with the bundles resolver instead.", - Type: []string{"string"}, - Format: "", - }, - }, }, }, }, 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/swagger.json b/pkg/apis/pipeline/v1beta1/swagger.json index 00322afb0e1..420c617204b 100644 --- a/pkg/apis/pipeline/v1beta1/swagger.json +++ b/pkg/apis/pipeline/v1beta1/swagger.json @@ -808,10 +808,6 @@ "description": "API version of the referent", "type": "string" }, - "bundle": { - "description": "Bundle url reference to a Tekton Bundle.\n\nDeprecated: Please use ResolverRef with the bundles resolver instead.", - "type": "string" - }, "name": { "description": "Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names", "type": "string" @@ -2507,10 +2503,6 @@ "description": "API version of the referent Note: A Task with non-empty APIVersion and Kind is considered a Custom Task", "type": "string" }, - "bundle": { - "description": "Bundle url reference to a Tekton Bundle.\n\nDeprecated: Please use ResolverRef with the bundles resolver instead.", - "type": "string" - }, "kind": { "description": "TaskKind indicates the Kind of the Task: 1. Namespaced Task when Kind is set to \"Task\". If Kind is \"\", it defaults to \"Task\". 2. Cluster-Scoped Task when Kind is set to \"ClusterTask\" 3. Custom Task when Kind is non-empty and APIVersion is non-empty", "type": "string" 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 {