Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d3276a01
Commit
d3276a01
authored
Oct 28, 2020
by
Shinya Maeda
Committed by
Nick Gaskill
Oct 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add warning about where feature flags cannot be used
parent
992f7468
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
doc/development/feature_flags/development.md
doc/development/feature_flags/development.md
+24
-0
No files found.
doc/development/feature_flags/development.md
View file @
d3276a01
...
...
@@ -188,6 +188,30 @@ if Feature.disabled?(:my_feature_flag, project, type: :ops)
end
```
DANGER:
**Warning:**
Don't use feature flags at application load time. For example, using the
`Feature`
class in
`config/initializers/*`
or at the class level could cause an unexpected error. This error occurs
because a database that a feature flag adapter might depend on doesn't exist at load time
(especially for fresh installations). Checking for the database's existence at the caller isn't
recommended, as some adapters don't require a database at all (for example, the HTTP adapter). The
feature flag setup check must be abstracted in the
`Feature`
namespace. This approach also requires
application reload when the feature flag changes. You must therefore ask SREs to reload the
Web/API/Sidekiq fleet on production, which takes time to fully rollout/rollback the changes. For
these reasons, use environment variables (for example,
`ENV['YOUR_FEATURE_NAME']`
) or
`gitlab.yml`
instead.
Here's an example of a pattern that you should avoid:
```
ruby
class
MyClass
if
Feature
.
enabled?
(:
...
)
new_process
else
legacy_process
end
end
```
### Frontend
Use the
`push_frontend_feature_flag`
method for frontend code, which is
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment