企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# Document features deployed behind feature flags > 原文:[https://docs.gitlab.com/ee/development/documentation/feature_flags.html](https://docs.gitlab.com/ee/development/documentation/feature_flags.html) * [Criteria](#criteria) * [Features disabled by default](#features-disabled-by-default) * [Features that became enabled by default](#features-that-became-enabled-by-default) * [Features directly enabled by default](#features-directly-enabled-by-default) * [Features with flag removed](#features-with-flag-removed) # Document features deployed behind feature flags[](#document-features-deployed-behind-feature-flags "Permalink") manbetx 客户端打不开使用[功能标志](../feature_flags/index.html)来战略性地推出自己的功能的部署. 我们在功能标记后面记录功能的方式取决于其状态(启用或禁用). 状态更改时,进行更改的开发人员**必须相应地更新文档** . ## Criteria[](#criteria "Permalink") 根据[部署功能标记后的 GitLab 功能](../feature_flags/process.html)的过程: > * *默认情况下,功能标志应处于关闭状态.* > * *功能标记应尽可能短地保留在代码库中,以减少对功能标记记帐的需求.* > * *为了构建最终版本并为自我管理的用户提供功能,功能标志至少应至少默认为 on.* 根据标志的状态,请参阅下面的文档说明: * [Features disabled by default](#features-disabled-by-default). * [Features that became enabled by default](#features-that-became-enabled-by-default). * [Features directly enabled by default](#features-directly-enabled-by-default). * [Features with the feature flag removed](#features-with-flag-removed). **注意:**功能级别的[`**(CORE ONLY)**`](styleguide.html#product-badges)徽标或等效标记应添加到以下行和标题中,即启用/禁用功能标志,因为这样做需要管理员访问权限,因此,它表示不能由 GitLab.com 的普通用户完成. ### Features disabled by default[](#features-disabled-by-default "Permalink") 对于默认情况下禁用的功能,如果由于缺乏完整性而无法使用它们,或者仍在内部评估中(例如,出于性能方面的考虑),请**不要对其进行文档化** :仅在以下情况下添加(或合并)文档:该功能是安全的,可供最终用户使用和测试. 对于默认情况下禁用的功能标志,如果最终用户可以使用它们: * 说默认情况下它是禁用的. * 说是否在 GitLab.com 上启用了它. * 说说是否可以针对每个项目启用或禁用它. * 说出是否建议将其用于生产. * 记录如何启用和禁用它. 例如,对于默认情况下禁用的功能,可以在每个项目上启用或禁用 GitLab.com 上禁用的功能,并且不准备用于生产环境: ``` # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. > - It's deployed behind a feature flag, disabled by default. > - It's disabled on GitLab.com. > - It's able to be enabled or disabled per-project > - It's not recommended for production use. > - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#anchor-to-section). **(CORE ONLY)** (...) ### Enable or disable <Feature Name> **(CORE ONLY)** <Feature Name> is under development and not ready for production use. It is deployed behind a feature flag that is **disabled by default**. [GitLab administrators with access to the GitLab Rails console](../path/to/administration/feature_flags.md) can enable it for your instance. <Feature Name> can be enabled or disabled per-project To enable it: ```ruby # Instance-wide Feature.enable(:<feature flag>) # or by project Feature.enable(:<feature flag>, Project.find(<project id>)) ``` To disable it: ```ruby # Instance-wide Feature.disable(:<feature flag>) # or by project Feature.disable(:<feature flag>, Project.find(<project id>)) ``` ``` 根据要记录的功能的状态来调整 Blur. ### Features that became enabled by default[](#features-that-became-enabled-by-default "Permalink") 对于默认启用的功能: * 假设默认情况下已启用它. * 说是否在 GitLab.com 上启用了它. * 说说是否可以针对每个项目启用或禁用它. * 说出是否建议将其用于生产. * 记录如何禁用和启用它. 例如,对于最初部署时默认情况下禁用的功能,默认情况下已启用,在 GitLab.com 上启用了该功能,该功能无法按项目启用或禁用,并且可以用于生产环境: ``` # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. > - It was deployed behind a feature flag, disabled by default. > - [Became enabled by default](link-to-issue) on GitLab 12.1. > - It's enabled on GitLab.com. > - It's not able to be enabled or disabled per-project > - It's recommended for production use. > - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#anchor-to-section). **(CORE ONLY)** (...) ### Enable or disable <Feature Name> **(CORE ONLY)** <Feature Name> is under development but ready for production use. It is deployed behind a feature flag that is **enabled by default**. [GitLab administrators with access to the GitLab Rails console](..path/to/administration/feature_flags.md) can opt to disable it for your instance it cannot be enabled or disabled per-project. To disable it: ```ruby Feature.disable(:<feature flag>) ``` To enable it: ```ruby Feature.enable(:<feature flag>) ``` ``` 根据要记录的功能的状态来调整 Blur. ### Features directly enabled by default[](#features-directly-enabled-by-default "Permalink") 对于默认启用的功能: * 说默认情况下已启用. * 说是否在 GitLab.com 上启用了它. * 说说是否可以针对每个项目启用或禁用它. * 说出是否建议将其用于生产. * 记录如何禁用和启用它. For example, for a feature enabled by default, enabled on GitLab.com, cannot be enabled or disabled per-project, and ready for production use: ``` # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. > - It's deployed behind a feature flag, enabled by default. > - It's enabled on GitLab.com. > - It's not able to be enabled or disabled per-project > - It's recommended for production use. > - For GitLab self-managed instances, GitLab administrators can opt to [disable it](#anchor-to-section). **(CORE ONLY)** (...) ### Enable or disable <Feature Name> **(CORE ONLY)** <Feature Name> is under development but ready for production use. It is deployed behind a feature flag that is **enabled by default**. [GitLab administrators with access to the GitLab Rails console](..path/to/administration/feature_flags.md) can opt to disable it for your instance. To disable it: ```ruby Feature.disable(:<feature flag>) ``` To enable it: ```ruby Feature.enable(:<feature flag>) ``` ``` 根据要记录的功能的状态来调整 Blur. ### Features with flag removed[](#features-with-flag-removed "Permalink") 功能准备就绪并且标记已删除后,请清理文档. 删除功能标记的提及,只保留一个在版本历史记录注释中提及该标记的注释: ``` # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. > - [Feature flag removed](link-to-issue) in GitLab 12.2. (...) ```