|
1 | 1 | # Feature Versioning
|
2 | 2 |
|
3 |
| -The stability levels of features (feature versioning) are independent of CRD API versions (API versioning). |
| 3 | +The stability levels of features (feature versioning) are independent of CRD [API versioning](./api-versioning.md). |
4 | 4 |
|
5 | 5 | ## Adding feature gates for API-driven features
|
6 |
| -API-driven features are features that are enabled via a specific field in pipeline API. They comply to the [feature gates](../../api_compatibility_policy.md#feature-gates) and the [feature graduation process](../../api_compatibility_policy.md#feature-graduation-process) specified in the [API compatibility policy](../../api_compatibility_policy.md). For example, [remote tasks](https://github.com/tektoncd/pipeline/blob/454bfd340d102f16f4f2838cf4487198537e3cfa/docs/taskruns.md#remote-tasks) is an API-driven feature. |
| 6 | +API-driven features are features that are accessed via a specific field in pipeline API. They comply to the [feature gates](../../api_compatibility_policy.md#feature-gates) and the [feature graduation process](../../api_compatibility_policy.md#feature-graduation-process) specified in the [API compatibility policy](../../api_compatibility_policy.md). For example, [remote tasks](https://github.com/tektoncd/pipeline/blob/454bfd340d102f16f4f2838cf4487198537e3cfa/docs/taskruns.md#remote-tasks) is an API-driven feature. |
| 7 | + |
| 8 | +## Adding feature gated API fields for API-driven features |
| 9 | +### Per-feature flag |
| 10 | + |
| 11 | +All new features added after [v0.53.0](https://github.com/tektoncd/pipeline/releases/tag/v0.53.0) will be enabled by their dedicated feature flags. To introduce a new per-feature flag, we will proceed as follows: |
| 12 | +- Add default values to the new per-feature flag for the new API-driven feature following the `PerFeatureFlag` struct in [feature_flags.go](./../../pkg/apis/config/feature_flags.go). |
| 13 | +- Write unit tests to verify the new feature flag and update all test cases that require the configMap setting, such as those related to provenance propagation. |
| 14 | +- To add integration tests: |
| 15 | + - First, add the tests to `pull-tekton-pipeline-alpha-integration-test` by enabling the newly-introduced per-feature flag at [alpha test Prow environment](./../../test/e2e-tests-kind-prow-alpha.env). |
| 16 | + - When the flag is promoted to `beta` stability level, change the test to use [beta Prow environment setup](./../../test/e2e-tests-kind-prow-beta.env). |
| 17 | + - To add additional CI tests for combinations of feature flags, add tests for all alpha feature flags being turned on, with one alpha feature turned off at a time. |
| 18 | +- Add the tested new per-feature flag key value to the [the pipeline configMap](./../../config/config-feature-flags.yaml). |
| 19 | +- Update documentations for the new alpha feature at [alpha-stability-level](./../additional-configs.md#alpha-features). |
| 20 | + |
| 21 | +#### Example of adding a new Per-feature flag |
| 22 | +1. Add the default value following the Per-Feature flag struct |
| 23 | +```golang |
| 24 | +const enableExampleNewFeatureKey = 'example-new-feature' |
| 25 | + |
| 26 | +var DefaultExampleNewFeatre = PerFeatureFlag { |
| 27 | + Name: enableExampleNewFeatureKey, |
| 28 | + Stability: AlphaAPIFields, |
| 29 | + Enabled: DefaultAlphaFeatureEnabled, |
| 30 | +} |
| 31 | +``` |
| 32 | +2. Add unit tests with the newly-introduced yamls `feature-flags-example-new-feature` and `feature-flags-invalid-example-new-feature` according to the existing testing framework. |
| 33 | + |
| 34 | +3. For integration tests, add `example-new-feature: true` to [alpha test Prow environment](./../../test/e2e-tests-kind-prow-alpha.env). |
| 35 | + |
| 36 | +4. Add `example-new-feature: false` to [the pipeline configMap](./../../config/config-feature-flags.yaml) with a release note. |
| 37 | + |
| 38 | +5. Update documentations for the new alpha feature at [alpha-stability-level](./../additional-configs.md#alpha-features). |
| 39 | + |
7 | 40 | ### `enable-api-fields`
|
8 | 41 |
|
9 |
| -We've introduced a feature-flag called `enable-api-fields` to the |
| 42 | +Prior to [v0.53.0](https://github.com/tektoncd/pipeline/tree/release-v0.53.x), we have had the global feature flag `enable-api-fields` in |
10 | 43 | [config-feature-flags.yaml file](../../config/config-feature-flags.yaml)
|
11 | 44 | deployed as part of our releases.
|
12 | 45 |
|
| 46 | +_Note that the `enable-api-fields` flag will has been deprecated since [v0.53.0](https://github.com/tektoncd/pipeline/tree/release-v0.53.x) and we will transition to use [Per-feature flags](#per-feature-flag) instead._ |
| 47 | + |
13 | 48 | This field can be configured either to be `alpha`, `beta`, or `stable`. This field is
|
14 | 49 | documented as part of our
|
15 | 50 | [install docs](../install.md#customizing-the-pipelines-controller-behavior).
|
|
0 commit comments