Ability to set feature flag on/off status per-environment
Problem to solve
As of the initial launch of feature flags, it's only possible to turn a feature flag on/off everywhere at once.
It is normal in a feature flag workflow to have different states on a per-environment basis; production may have a feature off still, for example, but it may be on in a staging environment. You may have a matrix like the following, for example:
You'd want the ability to control those toggles individually, rather than just having one button that turns it on and off everywhere as it is now.
There are two main contexts where you'll be changing feature flags:
- Feature Flag view: Where you're looking at one feature flag, and want to toggle that feature flag on or off in various environments. That is covered by this issue.
- Environment view: Where you're looking at one environment, and want to toggle various feature flags on or off. That is covered by #9098 and considered out of scope for this one, but is referenced here as an important context to consider.
It will be possible, for all environments, to be able to individually set the on/off status for a feature flag. Feature flag behavior is built up by creating a set of rules based on environment specs. There is always a default wildcard rule (
*), but you are able to add more rules by adding more environment specs (for example,
review/*, and you can add as many as you need. The most specific rule that matches in the list is used. Each environment spec/the default has an ON/OFF value which indicates the behavior if that is the most specific match for the environment in question.
Adding and removing rules should work similarly to the table where you add secret variables to a project; you can add a row at a time, and each time you add a row, a new blank one at the bottom is prepared for you.
A note on terminology: A feature flag can be
inactive. A feature flag is enabled on at least one environment. An environment spec rule can be set which results in the API returning
off for that environment via the API. If all rules are set to return
off, then a feature flag is
inactive; otherwise it is
Feature Flag overview
|Feature Flag overview||Mobile|
Create New/Edit Feature Flag
- User sees a tabular list of existing Feature Flags on the overview page.
- Additionally, the table should display a new column with the environments the Feature Flag is active on. The environments are displayed in labels. Hovering the label should display a tooltip.
- The tags are displayed in a similar order as they are set by the user in the create form
- User clicks the button to Create or Edit a Feature Flag, he/she is taken to a detail view. The detail view page shows the already implemented form, and additionally it should include a table view with:
- Section header and helper text.
- A dropdown select component, with the ability to see/select/filter existing environments.
- A toggle component, displayed on a 'Status' column. Toggling it 'on' should activate the flag for the environment. Toggling it 'off' should inactivate it.
- The default scope's (
*) spec is not editable but users can toggle it on/off
- Changes will be applied once the user hits the 'Save' button. User should then be redirected to the overview page, just as current implemented flow.
- Remove the checkbox option in the original form to set the environment status.
- Update the tab navigation labels to match correct statuses naming
What does success look like, and how can we measure that?
- User should be able to set the status of a Feature Flag per environment via Feature Flags page.
- Support Ajax endpoints for FeatureFlagsController !9127 (merged)
- Multiple environments support for feature flags (Unleash API standpoint) !9110 (merged)
- Support CURD operation for feature flag scopes (GitLab internal API standpoint) !9182 (merged)
- BE small fix => !9357 (merged)
- Move the rest of the index page into Vue - !9155 (merged)
- Add column in the index page - !9196 (merged)
- Move new/edit pages into vue - !9228 (merged)
- Add environments to new/edit pages - !9228 (merged)
- Remove "Application name: production" from the modal - !9262 (merged)
- Feature specs => !9357 (merged)
- Documents => !9385 (merged)
Links / references
- gitlab-ce#56310 later adds sorting for the list of environment scopes