Skip to content

Add user_list to feature_flag api

What does this MR do and why?

related issue: #417984 (closed)

Add strategy user_list to feature flags api

Screenshots or screen recordings

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

Before After

How to set up and validate locally

  1. Create a project and remember the project ID: {{PROJECT_ID}}
  2. Create a personal access token: {{ACCESS_TOKEN}}
  3. Create a user list (replace {{PROJECT_ID}} and {{ACCESS_TOKEN}}):
    curl --location 'http://localhost:3000/api/v4/projects/{{PROJECT_ID}}/feature_flags_user_lists' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
    --data '{
        "name": "my_user_list",
        "user_xids": "user1,user2,user3"
    }'
  4. Remember the user list ID: {{USER_LIST_ID}}
  5. Create a feature flag with the user list as strategy (replace {{PROJECT_ID}}, {{ACCESS_TOKEN}} and {{USER_LIST_ID}}):
    curl --location 'http://localhost:3000/api/v4/projects/{{PROJECT_ID}}/feature_flags' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer {{ACCESS_TOKEN}}' \
    --data '{
        "name": "test",
        "version": "new_version_flag",
        "strategies": [
            {
                "name": "gitlabUserList",
                "user_list_id": {{USER_LIST_ID}}
            }
        ]
    }'
  6. The feature flag should be successfully created

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 Andy Schoenen

Merge request reports

Loading