2

We upgraded our self-hosted gitlab-ce to the latest 11.11 which brings in multiple reviewer merge request approval feature. Although this needs to be explicitly enabled via gitlab-rails console.

On the machine running our gitlab instance, I ran gitlab-rails console and got to a ruby console where I put in Feature.enable(:approval_rules) and hit Enter but I get:

>> Feature.enable(:approval_rules)
Nothing known about Feature.enable(

I do not have much experience with ruby so am not sure what am doing wrong. I searched on the web but I found documentation on how to develop with Ruby's "feature flags" but not how to enable them as a end user of the application.

2
  • Is your installation an omnibus installation or one from source? If you're not using omnibus, the proper way to activate the rails console is as follows: RAILS_ENV=production sudo -u git -H bundle exec rails console Commented Jan 14, 2020 at 22:55
  • @sytech same problem here, and your command results in "sudo: bundle: command not found", so I assume that's not it. Commented Oct 6, 2021 at 13:53

2 Answers 2

2

You can do it via the GitLab api.

POST to https://gitlab.myhost.com/api/v4/features/approval_rules with the payload

{
    "value": true
}

https://docs.gitlab.com/ee/api/features.html

Additionally, I found that the new approval rules workflow was automatically enabled upon upgrading from 11.9 to 11.10, though my experience may be different. If you perform a GET to that API endpoint, you will be able to see its current status.

If it is already enabled, perhaps you may be mistaking the new approval rules implementation with the EE feature Multiple Approval Rules. I only mention due to the -ce tag in your question.

Sign up to request clarification or add additional context in comments.

2 Comments

I later found out that some features are not available in CE. The documentation at the top mentions in which editions the features documented are available. thanks for the answer though.
@SindhuS so if it says "Introduced in GitLab 11.2. Requires GitLab Runner 11.2 and above." it means it is not available in GitLab CE?
0

With GitLab 13.5 (October 2020), actual feature flags are available for all:

Feature Flags made available in all tiers

Earlier this year, we committed to moving 18 features to our open source Core product and took the first step in delivering on this promise by making Feature Flags available in Starter in the last release.

Now we’ve officially finished moving Feature Flags to our Core offering. We’re excited about making these features available to more of the GitLab community and seeing the positive impact it’ll have on your development workflow.

See Documentation and Issue.

That includes, still with GitLab 13.5 (October 2020):

Feature Flags flexible rollout strategy

When you use the percent rollout strategy today, the stickiness, or the experience consistency, is determined only by the user ID. This can be limiting; as an example, anonymous users cannot be affected by this strategy.

We have improved this rollout strategy by enabling you to define the stickiness based on session ID, user ID, or at random (no stickiness). This gives you more control over the rollout and allows you to support stickiness for anonymous users.

https://about.gitlab.com/images/13_5/percent-rollout.png -- Feature Flags flexible rollout strategy

See Documentation and Issue.

The feature flag API is more about creation/update/deletion.

You will have to use a feature flag strategy in order to enable/disable a feature flag.

Feature.disable(:feature_flags_new_version)
Feature.enable(:feature_flags_new_version)

See also GitLab 13.6 (November 2020)

Fire Webhook on Feature Flag change

As a developer, you can use GitLab’s webhook features for various events, such as MR events, pipeline events, job events, and deployment events. In this release, you can now use webhook events when a feature flag is toggled either on or off. This addition streamlines the process to update your CI/CD pipelines, receive Slack notifications for events, and more. A huge thanks to Sashi for a great community contribution!

See Documentation and Issue.


GitLab 16.3 (August 2023) adds:

Wrap feature flag names instead of truncating

If you used feature flags in previous versions of GitLab, you might have noticed that long feature flag names were truncated. This made it difficult to quickly differentiate similar feature flag names.

In GitLab 16.3, the entire feature flag name is shown. Long names wrap across multiple lines, if needed.

See Documentation and Issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.