debian-mirror-gitlab/doc/development/documentation/feature_flags.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

177 lines
9.3 KiB
Markdown
Raw Normal View History

2020-05-24 23:13:21 +05:30
---
2022-11-25 23:54:43 +05:30
info: For assistance with this Style Guide page, see https://about.gitlab.com/handbook/product/ux/technical-writing/#assignments-to-other-projects-and-subjects.
2022-03-02 08:16:31 +05:30
stage: none
group: unassigned
2020-05-24 23:13:21 +05:30
description: "GitLab development - how to document features deployed behind feature flags"
---
# Document features deployed behind feature flags
2023-05-27 22:25:52 +05:30
GitLab uses [feature flags](../feature_flags/index.md) to roll
out the deployment of its own features.
When the state of a feature flag changes, the developer who made the change
**must update the documentation**.
2020-05-24 23:13:21 +05:30
2023-04-23 21:23:45 +05:30
## When to document features behind a feature flag
Every feature introduced to the codebase, even if it's behind a disabled feature flag,
must be documented. For more information, see
2023-05-27 22:25:52 +05:30
[the discussion that led to this decision](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/47917#note_459984428). [Alpha, Beta, or Limited Availability](../../policy/alpha-beta-support.md) features are usually behind a feature flag, and must also be documented. For more information, see [Document Alpha, Beta, LA features](alpha_beta.md).
When the feature is [implemented in multiple merge requests](../feature_flags/index.md#feature-flags-in-gitlab-development),
discuss the plan with your technical writer.
2023-04-23 21:23:45 +05:30
2023-05-27 22:25:52 +05:30
You can create a documentation issue and delay the documentation if the feature:
2023-04-23 21:23:45 +05:30
- Is far-reaching (makes changes across many areas of GitLab), like navigation changes.
- Includes many MRs.
- Affects more than a few documentation pages.
- Is not fully functional if the feature flag is enabled for testing.
2023-05-27 22:25:52 +05:30
The PM, EM, and writer should make sure the documentation work is assigned and scheduled.
Every feature flag in the codebase is [in the documentation](../../user/feature_flags.md),
even when the feature is not fully functional or otherwise documented.
2023-04-23 21:23:45 +05:30
## How to add feature flag documentation
2021-04-17 20:07:23 +05:30
2021-10-27 15:23:28 +05:30
When you document feature flags, you must:
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
- [Add version history text](#add-version-history-text).
2022-06-21 17:19:12 +05:30
- [Add a note at the start of the topic](#use-a-note-to-describe-the-state-of-the-feature-flag).
## Add version history text
2022-10-11 01:57:18 +05:30
When the state of a flag changes (for example, disabled by default to enabled by default), add the change to the
[version history](versions.md#add-a-version-history-item).
2022-06-21 17:19:12 +05:30
Possible version history entries are:
```markdown
2022-07-23 23:45:48 +05:30
> - [Introduced](issue-link) in GitLab X.X [with a flag](../../administration/feature_flags.md) named `flag_name`. Disabled by default.
2022-06-21 17:19:12 +05:30
> - [Enabled on GitLab.com](issue-link) in GitLab X.X.
> - [Enabled on GitLab.com](issue-link) in GitLab X.X. Available to GitLab.com administrators only.
> - [Enabled on self-managed](issue-link) in GitLab X.X.
2022-11-25 23:54:43 +05:30
> - [Generally available](issue-link) in GitLab X.Y. Feature flag `flag_name` removed.
2022-06-21 17:19:12 +05:30
```
2021-10-27 15:23:28 +05:30
## Use a note to describe the state of the feature flag
2020-05-24 23:13:21 +05:30
2022-07-16 23:28:13 +05:30
Information about feature flags should be in a `FLAG` note at the start of the topic (just below the version history).
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
The note has three parts, and follows this structure:
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
```markdown
FLAG:
2022-06-21 17:19:12 +05:30
<Self-managed GitLab availability information.>
<GitLab.com availability information.>
2021-10-27 15:23:28 +05:30
<This feature is not ready for production use.>
2020-05-24 23:13:21 +05:30
```
2023-01-13 00:05:48 +05:30
A `FLAG` note renders on the GitLab documentation site as:
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](../../administration/feature_flags.md) named `example_flag`.
On GitLab.com, this feature is not available.
This feature is not ready for production use.
2021-10-27 15:23:28 +05:30
### Self-managed GitLab availability information
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
| If the feature is... | Use this text |
|--------------------------|---------------|
2022-07-23 23:45:48 +05:30
| Available | ``On self-managed GitLab, by default this feature is available. To hide the feature, ask an administrator to [disable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Unavailable | ``On self-managed GitLab, by default this feature is not available. To make it available, ask an administrator to [enable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Available to some users | ``On self-managed GitLab, by default this feature is available to a subset of users. To show or hide the feature for all, ask an administrator to [change the status of the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Available, per-group | ``On self-managed GitLab, by default this feature is available. To hide the feature per group, ask an administrator to [disable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Unavailable, per-group | ``On self-managed GitLab, by default this feature is not available. To make it available per group, ask an administrator to [enable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Available, per-project | ``On self-managed GitLab, by default this feature is available. To hide the feature per project or for your entire instance, ask an administrator to [disable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Unavailable, per-project | ``On self-managed GitLab, by default this feature is not available. To make it available per project or for your entire instance, ask an administrator to [enable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Available, per-user | ``On self-managed GitLab, by default this feature is available. To hide the feature per user, ask an administrator to [disable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
| Unavailable, per-user | ``On self-managed GitLab, by default this feature is not available. To make it available per user, ask an administrator to [enable the feature flag](<path to>/administration/feature_flags.md) named `flag_name`.`` |
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
### GitLab.com availability information
2020-05-24 23:13:21 +05:30
2022-07-16 23:28:13 +05:30
| If the feature is... | Use this text |
|---------------------------------------------|---------------|
| Available | `On GitLab.com, this feature is available.` |
| Available to GitLab.com administrators only | `On GitLab.com, this feature is available but can be configured by GitLab.com administrators only.`
| Unavailable | `On GitLab.com, this feature is not available.`|
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
### Optional information
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
If needed, you can add this sentence:
2020-11-24 15:15:51 +05:30
2022-01-26 12:08:38 +05:30
`The feature is not ready for production use.`
2020-11-24 15:15:51 +05:30
2021-10-27 15:23:28 +05:30
## Feature flag documentation examples
2020-11-24 15:15:51 +05:30
2021-10-27 15:23:28 +05:30
The following examples show the progression of a feature flag.
2020-11-24 15:15:51 +05:30
2021-10-27 15:23:28 +05:30
```markdown
2021-11-18 22:05:49 +05:30
> Introduced in GitLab 13.7 [with a flag](../../administration/feature_flags.md) named `forti_token_cloud`. Disabled by default.
2020-11-24 15:15:51 +05:30
2021-10-27 15:23:28 +05:30
FLAG:
On self-managed GitLab, by default this feature is not available. To make it available,
2021-12-11 22:18:48 +05:30
ask an administrator to [enable the feature flag](../administration/feature_flags.md) named `forti_token_cloud`.
2021-10-27 15:23:28 +05:30
The feature is not ready for production use.
2020-11-24 15:15:51 +05:30
```
2021-11-11 11:23:49 +05:30
When the feature is enabled in production, you can update the version history:
2020-11-24 15:15:51 +05:30
2021-10-27 15:23:28 +05:30
```markdown
2021-11-18 22:05:49 +05:30
> - Introduced in GitLab 13.7 [with a flag](../../administration/feature_flags.md) named `forti_token_cloud`. Disabled by default.
2021-11-11 11:23:49 +05:30
> - [Enabled on self-managed](https://gitlab.com/issue/etc) GitLab 13.8.
2020-05-24 23:13:21 +05:30
2021-10-27 15:23:28 +05:30
FLAG:
On self-managed GitLab, by default this feature is available. To hide the feature per user,
2021-11-18 22:05:49 +05:30
ask an administrator to [disable the feature flag](../administration/feature_flags.md) named `forti_token_cloud`.
2020-11-24 15:15:51 +05:30
```
2021-10-27 15:23:28 +05:30
And, when the feature is done and fully available to all users:
2020-11-24 15:15:51 +05:30
2021-10-27 15:23:28 +05:30
```markdown
2021-11-18 22:05:49 +05:30
> - Introduced in GitLab 13.7 [with a flag](../../administration/feature_flags.md) named `forti_token_cloud`. Disabled by default.
2022-01-26 12:08:38 +05:30
> - [Enabled on self-managed](https://gitlab.com/issue/etc) in GitLab 13.8.
2021-11-11 11:23:49 +05:30
> - [Enabled on GitLab.com](https://gitlab.com/issue/etc) in GitLab 13.9.
2022-11-25 23:54:43 +05:30
> - [Generally available](issue-link) in GitLab 14.0. Feature flag `forti_token_cloud` removed.
2020-05-24 23:13:21 +05:30
```
2023-05-27 22:25:52 +05:30
## Simplify long version history
The version history can get long, but you can sometimes simplify or remove entries.
Combine entries if they happened in the same release:
- Before:
```markdown
> - [Introduced](issue-link) in GitLab 14.2 [with a flag](../../administration/feature_flags.md) named `ci_include_rules`. Disabled by default.
> - [Enabled on GitLab.com](issue-link) in GitLab 14.3.
> - [Enabled on self-managed](issue-link) in GitLab 14.3.
```
- After:
```markdown
> - [Introduced](issue-link) in GitLab 14.2 [with a flag](../../administration/feature_flags.md) named `ci_include_rules`. Disabled by default.
> - [Enabled on GitLab.com and self-managed](issue-link) in GitLab 14.3.
```
Remove `Enabled on GitLab.com` entries when the feature is enabled by default for both GitLab.com and self-managed:
- Before:
```markdown
> - [Introduced](issue-link) in GitLab 15.6 [with a flag](../../administration/feature_flags.md) named `ci_hooks_pre_get_sources_script`. Disabled by default.
> - [Enabled on GitLab.com](issue-link) in GitLab 15.9.
> - [Generally available](issue-link) in GitLab 15.10. Feature flag `ci_hooks_pre_get_sources_script` removed.
```
- After:
```markdown
> - [Introduced](issue-link) in GitLab 15.6 [with a flag](../../administration/feature_flags.md) named `ci_hooks_pre_get_sources_script`. Disabled by default.
> - [Generally available](issue-link) in GitLab 15.10. Feature flag `ci_hooks_pre_get_sources_script` removed.
```