Skip to content

Add `gitlab_team_members` feature group

Brian Williams requested to merge bwill/team-members-feature-group into master

What does this MR do and why?

Describe in detail what your merge request does and why.

Allow user-based feature flags to be enabled for all GitLab team members by using a feature group. The flag can then be enabled via the API with:

POST /api/v4/features/:name

value=true&feature_group=gitlab_team_members

Before this can be used with GitLab.com chatops, the flags need to be updated to support the feature_group parameter.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

asciicast

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Simulate GitLab Saas

  2. Manually edit GITLAB_COM_GROUP_ID to the id of the group that you would like to test with

  3. Create a PAT.

  4. Create a test feature flag: bin/feature-flag test (Press enter on all prompts)

  5. Enable the flag: curl -d 'value=true&feature_group=gitlab_team_members' -H "PRIVATE_TOKEN: $GITLAB_TOKEN" http://gdk.local:3000/api/v4/features/test

  6. Start the rails console: bundle exec rails c

  7. Check that the feature is enabled for all members of the group:

    ENV['GITLAB_SIMULATE_SAAS'] = '1'
    group = Group.find(31)
    group.members.map { |member| Feature.enabled?(:test, member.user) }
  8. Check the feature is not enabled for non-members:

    non_member = User.id_not_in(group.members.pluck_user_ids).first
    Feature.enabled?(:test, non_member)

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 Brian Williams

Merge request reports

Loading