Skip to content

Extend `feature_available?` check to include Usage Ping features

Fabio Pitino requested to merge extend-feature-available-with-usage-ping into master

What does this MR do and why?

The problem this MR is solving is largely described in Include Registration Features check in SSoT met... (#422620 - closed).

We are going to extend License.feature_available? to also take in consideration if any features have become available at instance-level when the admin enables Usage Pings.

In order to incentivise customers to send us Usage Pings we offer a set of features. For example: when using Enterprise Edition with a Free tier/license, if the admin enables Usage Pings the users get access to some paid features.

Instead of making changes everywhere, which is the pattern we are using at the moment (like in !119850 (diffs)), we should simply move the feature from the paid tier to the relative usage pings features. The feature checks should remain unchanged.

How to set up and validate locally

# Ensure FF is still disabled:
Feature.enabled?(:feature_available_check_with_usage_ping) #=> false

# Ensure Usage Pings are not yet enable:
Gitlab::CurrentSettings.usage_ping_features_enabled? #=> false

# Ensure a usage ping feature is not available:
License.feature_available?(:password_complexity) #=> false
GitlabSubscriptions::Features.usage_ping_feature?(:password_complexity) #=> false

# Enable usage ping features
Gitlab::CurrentSettings.update!(usage_ping_features_enabled: true)

# Usage ping feature is still not globally available through the License check
# but it's available via the internal usage ping check:
License.feature_available?(:password_complexity) #=> false
GitlabSubscriptions::Features.usage_ping_feature?(:password_complexity) #=> true

# Enable the feature flag
Feature.enable(:feature_available_check_with_usage_ping)

# Ensure the usage ping feature is now globally available
License.feature_available?(:password_complexity) #=> true
GitlabSubscriptions::Features.usage_ping_feature?(:password_complexity) #=> true

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Fabio Pitino

Merge request reports