Skip to content

Support multi-actor args in the feature API

Shinya Maeda requested to merge support-multiple-actor-args-in-feature-api into master

What does this MR do and why?

Currently, the chatops commands for feature flags don't support multiple arguments. This sometimes result in an awkward situation that the #production channel becomes very noisy by the commands and responses. Also, it takes long time to finish one command and another.

Related gitlab-com/chatops#120 (closed)

Support multiple actor arguments for specific rollout

Before

/chatops run feature set --project=gitlab-org/gitlab <flag-name> true
/chatops run feature set --project=gitlab-org/gitlab-foss <flag-name> true
/chatops run feature set --project=gitlab-com/www-gitlab-com <flag-name> true

After

/chatops run feature set --project="gitlab-org/gitlab,gitlab-org/gitlab-foss,gitlab-com/www-gitlab-com" <flag-name> true

Screenshots or screen recordings

curl --data "value=true&project=xyz-org/awesome-project,xyz-org1/awesome-project,developer/awesome-project" --header "PRIVATE-TOKEN: " "http://local.gitlab.test:8181/api/v4/features/add_timezone_to_web_operations"
[4] pry(main)> Feature::FlipperGate.all.map { |g| [g.feature_key, g.key, g.value] }
  Feature::FlipperGate Load (0.4ms)  SELECT "feature_gates".* FROM "feature_gates" /*application:console,db_config_name:main,line:(pry):4:in `map'*/
=> [["fix_related_environments_for_merge_requests", "boolean", "true"],
 ["deployment_approval_rules", "boolean", "true"],
 ["ci_reduce_persistent_ref_writes", "boolean", "true"],
 ["ci_skip_persistent_ref_existence_check", "boolean", "true"],
 ["add_timezone_to_web_operations", "actors", "Project:23"],
 ["add_timezone_to_web_operations", "actors", "Project:24"],
 ["add_timezone_to_web_operations", "actors", "Project:25"]]
curl --data "value=false&project=xyz-org/awesome-project,xyz-org1/awesome-project,developer/awesome-project" --header "PRIVATE-TOKEN: " "http://local.gitlab.test:8181/api/v4/features/add_timezone_to_web_operations"
[5] pry(main)> Feature::FlipperGate.all.map { |g| [g.feature_key, g.key, g.value] }
  Feature::FlipperGate Load (0.4ms)  SELECT "feature_gates".* FROM "feature_gates" /*application:console,db_config_name:main,line:(pry):5:in `map'*/
=> [["fix_related_environments_for_merge_requests", "boolean", "true"],
 ["deployment_approval_rules", "boolean", "true"],
 ["ci_reduce_persistent_ref_writes", "boolean", "true"],
 ["ci_skip_persistent_ref_existence_check", "boolean", "true"]]

How to set up and validate locally

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

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 Shinya Maeda

Merge request reports