Skip to content

Commit bf3749d

Browse files
committed
Put Tekton OCI bundles behind a feature flags 🎏
In order to expose Tekton OCI bundle less and mark them as "alpha" still, let's put their usage under a feature-flag. This will allow us to experiment, refactor and enhance those without having to support them nor expose them too much to the end-user. Enabling the feature gates is a explicit choice for the user and is documented to make sure users understand this is subject to changes. This adds a new feature-flags field called "enable-tekton-oci-bundles" that defaults to false. If the feature-flag is off, Tekton OCI bundle are not usable. The admission controller will disallow its usage, and the controller will not take the bundle field into account. Note: the e2e tests will be skip on the CI temporarly because we do not have the *framework* in place to switch feature-flags during tests. This will be worked out in parallel. Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
1 parent 7b5b2fa commit bf3749d

18 files changed

+386
-254
lines changed

config/config-feature-flags.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,7 @@ data:
7878
# See https://github.com/tektoncd/pipeline/issues/2981 for more
7979
# info.
8080
require-git-ssh-secret-known-hosts: "false"
81+
# Setting this flag to "true" enables the use of Tekton OCI bundle.
82+
# This is an experimental feature and thus should still be considered
83+
# an alpha feature.
84+
enable-tekton-oci-bundles: "false"

docs/install.md

+12-4
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ data:
264264
265265
## Configuring self-signed cert for private registry
266266
267-
The `SSL_CERT_DIR` is set to `/etc/ssl/certs` as the default cert directory. If you are using a self-signed cert for private registry and the cert file is not under the default cert directory, configure your registry cert in the `config-registry-cert` `ConfigMap` with the key `cert`.
267+
The `SSL_CERT_DIR` is set to `/etc/ssl/certs` as the default cert directory. If you are using a self-signed cert for private registry and the cert file is not under the default cert directory, configure your registry cert in the `config-registry-cert` `ConfigMap` with the key `cert`.
268268
269269
## Customizing basic execution parameters
270270
@@ -303,7 +303,7 @@ file lists the keys you can customize along with their default values.
303303
To customize the behavior of the Pipelines Controller, modify the ConfigMap `feature-flags` as follows:
304304

305305
- `disable-affinity-assistant` - set this flag to `true` to disable the [Affinity Assistant](./workspaces.md#specifying-workspace-order-in-a-pipeline-and-affinity-assistants)
306-
that is used to provide Node Affinity for `TaskRun` pods that share workspace volume.
306+
that is used to provide Node Affinity for `TaskRun` pods that share workspace volume.
307307
The Affinity Assistant is incompatible with other affinity rules
308308
configured for `TaskRun` pods.
309309

@@ -326,7 +326,7 @@ for each `Step` that does not have its working directory explicitly set with `/w
326326
For more information, see the [associated issue](https://github.com/tektoncd/pipeline/issues/1836).
327327

328328
- `running-in-environment-with-injected-sidecars`: set this flag to `"true"` to allow the
329-
Tekton controller to set the `tekton.dev/ready` annotation at pod creation time for
329+
Tekton controller to set the `tekton.dev/ready` annotation at pod creation time for
330330
TaskRuns with no Sidecars specified. Enabling this option should decrease the time it takes for a TaskRun to
331331
start running. However, for clusters that use injected sidecars e.g. istio
332332
enabling this option can lead to unexpected behavior.
@@ -335,7 +335,15 @@ enabling this option can lead to unexpected behavior.
335335
Git SSH Secrets include a `known_hosts` field. This ensures that a git remote server's
336336
key is validated before data is accepted from it when authenticating over SSH. Secrets
337337
that don't include a `known_hosts` will result in the TaskRun failing validation and
338-
not running.
338+
not running.
339+
340+
- `enable-tekton-oci-bundles`: set this flag to `"true"` to enable the
341+
tekton OCI bundle usage (see [the tekton bundle
342+
contract](./tekton-bundle-contracts.md)). Enabling this option
343+
allows the use of `bundle` field in `taskRef` and `pipelineRef` for
344+
`Pipeline`, `PipelineRun` and `TaskRun`. By default, this option is
345+
disabled (`"false"`), which means it is disallowed to use the
346+
`bundle` field.
339347

340348
For example:
341349

docs/pipelineruns.md

+31-26
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ A `PipelineRun` definition supports the following fields:
6060
object that supplies specific execution credentials for the `Pipeline`.
6161
- [`serviceAccountNames`](#mapping-serviceaccount-credentials-to-tasks) - Maps specific `serviceAccountName` values
6262
to `Tasks` in the `Pipeline`. This overrides the credentials set for the entire `Pipeline`.
63-
- [`taskRunSpec`](#specifying-task-run-specs) - Specifies a list of `PipelineRunTaskSpec` which allows for setting `ServiceAccountName` and [`Pod` template](./podtemplates.md) for each task. This overrides the `Pod` template set for the entire `Pipeline`.
63+
- [`taskRunSpec`](#specifying-task-run-specs) - Specifies a list of `PipelineRunTaskSpec` which allows for setting `ServiceAccountName` and [`Pod` template](./podtemplates.md) for each task. This overrides the `Pod` template set for the entire `Pipeline`.
6464
- [`timeout`](#configuring-a-failure-timeout) - Specifies the timeout before the `PipelineRun` fails.
6565
- [`podTemplate`](#pod-template) - Specifies a [`Pod` template](./podtemplates.md) to use as the basis
6666
for the configuration of the `Pod` that executes each `Task`.
@@ -70,7 +70,7 @@ A `PipelineRun` definition supports the following fields:
7070

7171
### Specifying the target `Pipeline`
7272

73-
You must specify the target `Pipeline` that you want the `PipelineRun` to execute, either by referencing
73+
You must specify the target `Pipeline` that you want the `PipelineRun` to execute, either by referencing
7474
an existing `Pipeline` definition, or embedding a `Pipeline` definition directly in the `PipelineRun`.
7575

7676
To specify the target `Pipeline` by reference, use the `pipelineRef` field:
@@ -81,22 +81,6 @@ spec:
8181
name: mypipeline
8282

8383
```
84-
85-
You may also use a `Tekton Bundle` to reference a pipeline defined remotely.
86-
87-
```yaml
88-
spec:
89-
pipelineRef:
90-
name: mypipeline
91-
bundle: docker.io/myrepo/mycatalog:v1.0
92-
```
93-
94-
The syntax and caveats are similar to using `Tekton Bundles` for `Task` references
95-
in [Pipelines](pipelines.md#tekton-bundles) or [TaskRuns](taskruns.md#tekton-bundles).
96-
97-
`Tekton Bundles` may be constructed with any toolsets that produce valid OCI image artifacts
98-
so long as the artifact adheres to the [contract](tekton-bundle-contracts.md).
99-
10084
To embed a `Pipeline` definition in the `PipelineRun`, use the `pipelineSpec` field:
10185

10286
```yaml
@@ -156,6 +140,27 @@ spec:
156140
...
157141
```
158142

143+
#### Tekton Bundles
144+
145+
**Note: This is only allowed if `enable-tekton-oci-bundles` is set to
146+
`"true"` in the `feature-flags` configmap, see [`install.md`](./install.md#customizing-the-pipelines-controller-behavior)**
147+
148+
You may also use a `Tekton Bundle` to reference a pipeline defined remotely.
149+
150+
```yaml
151+
spec:
152+
pipelineRef:
153+
name: mypipeline
154+
bundle: docker.io/myrepo/mycatalog:v1.0
155+
```
156+
157+
The syntax and caveats are similar to using `Tekton Bundles` for `Task` references
158+
in [Pipelines](pipelines.md#tekton-bundles) or [TaskRuns](taskruns.md#tekton-bundles).
159+
160+
`Tekton Bundles` may be constructed with any toolsets that produce valid OCI image artifacts
161+
so long as the artifact adheres to the [contract](tekton-bundle-contracts.md).
162+
163+
159164
## Specifying `Resources`
160165

161166
A `Pipeline` requires [`PipelineResources`](resources.md) to provide inputs and store outputs
@@ -223,7 +228,7 @@ to all `persistentVolumeClaims` generated internally.
223228
You can specify `Parameters` that you want to pass to the `Pipeline` during execution,
224229
including different values of the same parameter for different `Tasks` in the `Pipeline`.
225230

226-
**Note:** You must specify all the `Parameters` that the `Pipeline` expects. Parameters
231+
**Note:** You must specify all the `Parameters` that the `Pipeline` expects. Parameters
227232
that have default values specified in Pipeline are not required to be provided by PipelineRun.
228233

229234
For example:
@@ -236,14 +241,14 @@ spec:
236241
- name: pl-param-y
237242
value: "500"
238243
```
239-
You can pass in extra `Parameters` if needed depending on your use cases. An example use
240-
case is when your CI system autogenerates `PipelineRuns` and it has `Parameters` it wants to
241-
provide to all `PipelineRuns`. Because you can pass in extra `Parameters`, you don't have to
244+
You can pass in extra `Parameters` if needed depending on your use cases. An example use
245+
case is when your CI system autogenerates `PipelineRuns` and it has `Parameters` it wants to
246+
provide to all `PipelineRuns`. Because you can pass in extra `Parameters`, you don't have to
242247
go through the complexity of checking each `Pipeline` and providing only the required params.
243248

244249
### Specifying custom `ServiceAccount` credentials
245250

246-
You can execute the `Pipeline` in your `PipelineRun` with a specific set of credentials by
251+
You can execute the `Pipeline` in your `PipelineRun` with a specific set of credentials by
247252
specifying a `ServiceAccount` object name in the `serviceAccountName` field in your `PipelineRun`
248253
definition. If you do not explicitly specify this, the `TaskRuns` created by your `PipelineRun`
249254
will execute with the credentials specified in the `configmap-defaults` `ConfigMap`. If this
@@ -256,7 +261,7 @@ For more information, see [`ServiceAccount`](auth.md).
256261

257262
If you require more granularity in specifying execution credentials, use the `serviceAccountNames` field to
258263
map a specific `serviceAccountName` value to a specific `Task` in the `Pipeline`. This overrides the global
259-
`serviceAccountName` you may have set for the `Pipeline` as described in the previous section.
264+
`serviceAccountName` you may have set for the `Pipeline` as described in the previous section.
260265

261266
For example, if you specify these mappings:
262267

@@ -358,7 +363,7 @@ spec:
358363
disktype: ssd
359364
```
360365

361-
If used with this `Pipeline`, `build-task` will use the task specific `PodTemplate` (where `nodeSelector` has `disktype` equal to `ssd`).
366+
If used with this `Pipeline`, `build-task` will use the task specific `PodTemplate` (where `nodeSelector` has `disktype` equal to `ssd`).
362367

363368
### Specifying `Workspaces`
364369

@@ -474,7 +479,7 @@ When a `PipelineRun` changes status, [events](events.md#pipelineruns) are trigge
474479

475480
When a `PipelineRun` has `Tasks` with [WhenExpressions](pipelines.md#guard-task-execution-using-whenexpressions):
476481
- If the `WhenExpressions` evaluate to `true`, the `Task` is executed then the `TaskRun` and its resolved `WhenExpressions` will be listed in the `Task Runs` section of the `status` of the `PipelineRun`.
477-
- If the `WhenExpressions` evaluate to `false`, the `Task` is skipped then its name and its resolved `WhenExpressions` will be listed in the `Skipped Tasks` section of the `status` of the `PipelineRun`.
482+
- If the `WhenExpressions` evaluate to `false`, the `Task` is skipped then its name and its resolved `WhenExpressions` will be listed in the `Skipped Tasks` section of the `status` of the `PipelineRun`.
478483

479484
```yaml
480485
Conditions:

docs/pipelines.md

+22-19
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ A `Pipeline` definition supports the following fields:
4545
- [`metadata`][kubernetes-overview] - Specifies metadata that uniquely identifies the
4646
`Pipeline` object. For example, a `name`.
4747
- [`spec`][kubernetes-overview] - Specifies the configuration information for
48-
this `Pipeline` object. This must include:
48+
this `Pipeline` object. This must include:
4949
- [`tasks`](#adding-tasks-to-the-pipeline) - Specifies the `Tasks` that comprise the `Pipeline`
5050
and the details of their execution.
5151
- Optional:
@@ -61,7 +61,7 @@ A `Pipeline` definition supports the following fields:
6161
execution of a `Task` after a failure. Does not apply to execution cancellations.
6262
- [`conditions`](#guard-task-execution-using-conditions) - Specifies `Conditions` that only allow a `Task`
6363
to execute if they successfully evaluate.
64-
- [`timeout`](#configuring-the-failure-timeout) - Specifies the timeout before a `Task` fails.
64+
- [`timeout`](#configuring-the-failure-timeout) - Specifies the timeout before a `Task` fails.
6565
- [`results`](#configuring-execution-results-at-the-pipeline-level) - Specifies the location to which
6666
the `Pipeline` emits its execution results.
6767
- [`description`](#adding-a-description) - Holds an informative description of the `Pipeline` object.
@@ -136,7 +136,7 @@ varies throughout its execution. If no value is specified, the `type` field defa
136136
When the actual parameter value is supplied, its parsed type is validated against the `type` field.
137137
The `description` and `default` fields for a `Parameter` are optional.
138138

139-
The following example illustrates the use of `Parameters` in a `Pipeline`.
139+
The following example illustrates the use of `Parameters` in a `Pipeline`.
140140

141141
The following `Pipeline` declares an input parameter called `context` and passes its
142142
value to the `Task` to set the value of the `pathToContext` parameter within the `Task`.
@@ -231,6 +231,9 @@ spec:
231231

232232
### Tekton Bundles
233233

234+
**Note: This is only allowed if `enable-tekton-oci-bundles` is set to
235+
`"true"` in the `feature-flags` configmap, see [`install.md`](./install.md#customizing-the-pipelines-controller-behavior)**
236+
234237
You may also specify your `Task` reference using a `Tekton Bundle`. A `Tekton Bundle` is an OCI artifact that
235238
contains Tekton resources like `Tasks` which can be referenced within a `taskRef`.
236239

@@ -244,7 +247,7 @@ contains Tekton resources like `Tasks` which can be referenced within a `taskRef
244247
```
245248

246249
Here, the `bundle` field is the full reference url to the artifact. The name is the
247-
`metadata.name` field of the `Task`.
250+
`metadata.name` field of the `Task`.
248251

249252
You may also specify a `tag` as you would with a Docker image which will give you a fixed,
250253
repeatable reference to a `Task`.
@@ -263,7 +266,7 @@ You may also specify a fixed digest instead of a tag.
263266
```yaml
264267
spec:
265268
tasks:
266-
- name: hello-world
269+
- name: hello-world
267270
taskRef:
268271
name: echo-task
269272
bundle: docker.io/myrepo/mycatalog@sha256:abc123
@@ -282,14 +285,14 @@ so long as the artifact adheres to the [contract](tekton-bundle-contracts.md).
282285

283286
If a `Task` in your `Pipeline` needs to use the output of a previous `Task`
284287
as its input, use the optional `from` parameter to specify a list of `Tasks`
285-
that must execute **before** the `Task` that requires their outputs as its
286-
input. When your target `Task` executes, only the version of the desired
288+
that must execute **before** the `Task` that requires their outputs as its
289+
input. When your target `Task` executes, only the version of the desired
287290
`PipelineResource` produced by the last `Task` in this list is used. The
288291
`name` of this output `PipelineResource` output must match the `name` of the
289-
input `PipelineResource` specified in the `Task` that ingests it.
292+
input `PipelineResource` specified in the `Task` that ingests it.
290293

291294
In the example below, the `deploy-app` `Task` ingests the output of the `build-app`
292-
`Task` named `my-image` as its input. Therefore, the `build-app` `Task` will
295+
`Task` named `my-image` as its input. Therefore, the `build-app` `Task` will
293296
execute before the `deploy-app` `Task` regardless of the order in which those
294297
`Tasks` are declared in the `Pipeline`.
295298

@@ -377,11 +380,11 @@ The components of `WhenExpressions` are `Input`, `Operator` and `Values`:
377380
- `Operator` represents an `Input`'s relationship to a set of `Values`. A valid `Operator` must be provided, which can be either `in` or `notin`.
378381
- `Values` is an array of string values. The `Values` array must be provided and be non-empty. It can contain static values or variables ([`Parameters`](#specifying-parameters), [`Results`](#using-results) or [a Workspaces's `bound` state](#specifying-workspaces)).
379382

380-
The [`Parameters`](#specifying-parameters) are read from the `Pipeline` and [`Results`](#using-results) are read directly from previous [`Tasks`](#adding-tasks-to-the-pipeline). Using [`Results`](#using-results) in a `WhenExpression` in a guarded `Task` introduces a resource dependency on the previous `Task` that produced the `Result`.
383+
The [`Parameters`](#specifying-parameters) are read from the `Pipeline` and [`Results`](#using-results) are read directly from previous [`Tasks`](#adding-tasks-to-the-pipeline). Using [`Results`](#using-results) in a `WhenExpression` in a guarded `Task` introduces a resource dependency on the previous `Task` that produced the `Result`.
381384

382-
The declared `WhenExpressions` are evaluated before the `Task` is run. If all the `WhenExpressions` evaluate to `True`, the `Task` is run. If any of the `WhenExpressions` evaluate to `False`, the `Task` is not run and the `Task` is listed in the [`Skipped Tasks` section of the `PipelineRunStatus`](pipelineruns.md#monitoring-execution-status).
385+
The declared `WhenExpressions` are evaluated before the `Task` is run. If all the `WhenExpressions` evaluate to `True`, the `Task` is run. If any of the `WhenExpressions` evaluate to `False`, the `Task` is not run and the `Task` is listed in the [`Skipped Tasks` section of the `PipelineRunStatus`](pipelineruns.md#monitoring-execution-status).
383386

384-
In these examples, `first-create-file` task will only be executed if the `path` parameter is `README.md`, `echo-file-exists` task will only be executed if the `exists` result from `check-file` task is `yes` and `run-lint` task will only be executed if the `lint-config` optional workspace has been provided by a PipelineRun.
387+
In these examples, `first-create-file` task will only be executed if the `path` parameter is `README.md`, `echo-file-exists` task will only be executed if the `exists` result from `check-file` task is `yes` and `run-lint` task will only be executed if the `lint-config` optional workspace has been provided by a PipelineRun.
385388

386389
```yaml
387390
tasks:
@@ -426,7 +429,7 @@ There are a lot of scenarios where `WhenExpressions` can be really useful. Some
426429

427430
### Guard `Task` execution using `Conditions`
428431

429-
**Note:** `Conditions` are deprecated, use [`WhenExpressions`](#guard-task-execution-using-whenexpressions) instead.
432+
**Note:** `Conditions` are deprecated, use [`WhenExpressions`](#guard-task-execution-using-whenexpressions) instead.
430433

431434
To run a `Task` only when certain conditions are met, it is possible to _guard_ task execution using
432435
the `conditions` field. The `conditions` field allows you to list a series of references to
@@ -450,17 +453,17 @@ tasks:
450453
name: deploy
451454
```
452455

453-
Unlike regular task failures, condition failures do not automatically fail the entire `PipelineRun` --
456+
Unlike regular task failures, condition failures do not automatically fail the entire `PipelineRun` --
454457
other tasks that are **not dependent** on the `Task` (via `from` or `runAfter`) are still run.
455458

456459
In this example, `(task C)` has a `condition` set to _guard_ its execution. If the condition
457460
is **not** successfully evaluated, task `(task D)` will not be run, but all other tasks in the pipeline
458461
that not depend on `(task C)` will be executed and the `PipelineRun` will successfully complete.
459-
462+
460463
```
461464
(task B) — (task E)
462-
/
463-
(task A)
465+
/
466+
(task A)
464467
\
465468
(guarded task C) — (task D)
466469
```
@@ -495,7 +498,7 @@ tasks:
495498
You can use the `Timeout` field in the `Task` spec within the `Pipeline` to set the timeout
496499
of the `TaskRun` that executes that `Task` within the `PipelineRun` that executes your `Pipeline.`
497500
The `Timeout` value is a `duration` conforming to Go's [`ParseDuration`](https://golang.org/pkg/time/#ParseDuration)
498-
format. For example, valid values are `1h30m`, `1h`, `1m`, and `60s`.
501+
format. For example, valid values are `1h30m`, `1h`, `1m`, and `60s`.
499502

500503
**Note:** If you do not specify a `Timeout` value, Tekton instead honors the timeout for the [`PipelineRun`](pipelineruns.md#configuring-a-pipelinerun).
501504

@@ -528,7 +531,7 @@ a `Result` and another receives it as a `Parameter` with a variable such as
528531
When one `Task` receives the `Results` of another, there is a dependency created between those
529532
two `Tasks`. In order for the receiving `Task` to get data from another `Task's` `Result`,
530533
the `Task` producing the `Result` must run first. Tekton enforces this `Task` ordering
531-
by ensuring that the `Task` emitting the `Result` executes before any `Task` that uses it.
534+
by ensuring that the `Task` emitting the `Result` executes before any `Task` that uses it.
532535

533536
In the snippet below, a param is provided its value from the `commit` `Result` emitted by the
534537
`checkout-source` `Task`. Tekton will make sure that the `checkout-source` `Task` runs

0 commit comments

Comments
 (0)