summaryrefslogtreecommitdiff
path: root/doc/development/feature_flags.md
diff options
context:
space:
mode:
authorMarcia Ramos <virtua.creative@gmail.com>2018-08-16 10:17:22 +0100
committerMarcia Ramos <virtua.creative@gmail.com>2018-08-16 10:17:22 +0100
commitbfc0c602072bd5b9bf73e117d0808043adc9465e (patch)
treeea55f6e86fdfdcccca9c593d5441c9d2c3efd441 /doc/development/feature_flags.md
parent1e23577417b3e4eb06b9aba1ec174dbe78b6b9be (diff)
parent0a666b2cb1020df4b8f7b71041b6bd109b49656a (diff)
downloadgitlab-ce-docs-processes.tar.gz
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce into docs-processesdocs-processes
Diffstat (limited to 'doc/development/feature_flags.md')
-rw-r--r--doc/development/feature_flags.md35
1 files changed, 34 insertions, 1 deletions
diff --git a/doc/development/feature_flags.md b/doc/development/feature_flags.md
index 5d1f657015c..09ea8c05be6 100644
--- a/doc/development/feature_flags.md
+++ b/doc/development/feature_flags.md
@@ -20,7 +20,40 @@ dynamic (querying the DB etc.).
Once defined in `lib/feature.rb`, you will be able to activate a
feature for a given feature group via the [`feature_group` param of the features API](../api/features.md#set-or-create-a-feature)
+For GitLab.com, team members have access to feature flags through chatops. Only
+percentage gates are supported at this time. Setting a feature to be used 50% of
+the time, you should execute `/chatops run feature set my_feature_flag 50`.
+
## Feature flags for user applications
GitLab does not yet support the use of feature flags in deployed user applications.
-You can follow the progress on that [in the issue on our issue tracker](https://gitlab.com/gitlab-org/gitlab-ee/issues/779). \ No newline at end of file
+You can follow the progress on that [in the issue on our issue tracker](https://gitlab.com/gitlab-org/gitlab-ee/issues/779).
+
+## Developing with feature flags
+
+In general, it's better to have a group- or user-based gate, and you should prefer
+it over the use of percentage gates. This would make debugging easier, as you
+filter for example logs and errors based on actors too. Futhermore, this allows
+for enabling for the `gitlab-org` group first, while the rest of the users
+aren't impacted.
+
+```ruby
+# Good
+Feature.enabled?(:feature_flag, project)
+
+# Avoid, if possible
+Feature.enabled?(:feature_flag)
+```
+
+To use feature gates based on actors, the model needs to respond to
+`flipper_id`. For example, to enable for the Foo model:
+
+```ruby
+class Foo < ActiveRecord::Base
+ include FeatureGate
+end
+```
+
+Features that are developed and are intended to be merged behind a feature flag
+should not include a changelog entry. The entry should be added in the merge
+request removing the feature flags.