From 351711c4ccbf8ced1438805b3fc2a5cd06a44381 Mon Sep 17 00:00:00 2001 From: Kazunori Kimura Date: Fri, 22 Mar 2024 18:32:35 +0900 Subject: [PATCH] Simplify message on feature flag target specified as reviewed like below: ```` Configuring gitlab::feature_flags... - Launching rails runner to set feature flags. This will take some time.... - Specified feature flags to be disabled: --- "auto_devops_banner_disabled" --- "invalid_flag_name" - Specified feature flags to be enabled --- "git_push_create_all_pipelines" --- "another_invalid_flag_name" - Following flags are probably invalid and have been ignored --- invalid_flag_name --- another_invalid_flag_name - Apply user defined feature flags: --- auto_devops_banner_disabled : off --- git_push_create_all_pipelines : on ```` - Do not `puts` parsed options (formatted by ruby's `.to_s`), `puts` each specified target with three hyphens instead - `puts` each ignored target on each line with three hyphens instead of single line csv --- assets/runtime/scripts/configure_feature_flags.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/assets/runtime/scripts/configure_feature_flags.rb b/assets/runtime/scripts/configure_feature_flags.rb index 484cf62ee..90ccd2dce 100644 --- a/assets/runtime/scripts/configure_feature_flags.rb +++ b/assets/runtime/scripts/configure_feature_flags.rb @@ -38,9 +38,13 @@ def parse_options(argv = ARGV) op.on("-d", "--disable feature_a,feature_b,feature_c", Array, "comma-separated list of feature flags to be disabled (defaults: ${opts[:to_be_disabled]})") { |v| opts[:to_be_disabled] = v.uniq + puts "- Specified feature flags to be disabled" + puts opts[:to_be_disabled].map { |f| format("--- %s", opt: f) } } op.on("-e", "--enable feature_a,feature_b,feature_c", Array, "comma-separated list of feature flags to be enabled (defaults: ${opts[:to_be_enabled]})") { |v| opts[:to_be_enabled] = v.uniq + puts "- Specified feature flags to be enabled" + puts opts[:to_be_enabled].map { |f| format("--- %s", opt: f) } } begin @@ -58,8 +62,6 @@ def parse_options(argv = ARGV) def run succeed, opts, args = parse_options if succeed - puts "- specified feature flags: #{opts.to_s}" - available_flags = self.available_feature_flags disable_targets = available_flags & opts[:to_be_disabled] enable_targets = available_flags & opts[:to_be_disabled] @@ -76,7 +78,8 @@ def run invalid_disable_targets = opts[:to_be_disabled] - disable_targets invalid_targets = invalid_disable_targets | invalid_enable_targets if invalid_targets.length > 0 - puts "- Following flags are probably invalid and have been ignored: #{invalid_enable_targets.to_a.join(",")}" + puts "- Following flags are probably invalid and have been ignored" + puts invalid_targets.map { |f| format("--- %s", name: f) } end end