From 60839442055086e7eaef6951b192329d70336817 Mon Sep 17 00:00:00 2001 From: Luke Duncalfe Date: Mon, 22 May 2023 09:31:59 +1200 Subject: [PATCH] Change flag to be ops type This flag was added in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36885 as an alternative way of mapping a Bitbucket Server import user to a GitLab user for some self-managed instances, and as such should be an `ops` feature flag as it is long-lived and is unlikely to be removed any time soon. --- .../bitbucket_server_user_mapping_by_username.yml | 6 +++--- lib/gitlab/bitbucket_server_import/importer.rb | 7 +++---- lib/gitlab/bitbucket_server_import/user_finder.rb | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) rename config/feature_flags/{development => ops}/bitbucket_server_user_mapping_by_username.yml (57%) diff --git a/config/feature_flags/development/bitbucket_server_user_mapping_by_username.yml b/config/feature_flags/ops/bitbucket_server_user_mapping_by_username.yml similarity index 57% rename from config/feature_flags/development/bitbucket_server_user_mapping_by_username.yml rename to config/feature_flags/ops/bitbucket_server_user_mapping_by_username.yml index c672eb1e64ebc8..9d86b4f5af470b 100644 --- a/config/feature_flags/development/bitbucket_server_user_mapping_by_username.yml +++ b/config/feature_flags/ops/bitbucket_server_user_mapping_by_username.yml @@ -1,8 +1,8 @@ --- name: bitbucket_server_user_mapping_by_username introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/36885 -rollout_issue_url: +rollout_issue_url: # No rollout: This is an ops-flag milestone: '13.4' -type: development +type: ops group: group::import -default_enabled: false +default_enabled: false # Flag should be kept disabled by default diff --git a/lib/gitlab/bitbucket_server_import/importer.rb b/lib/gitlab/bitbucket_server_import/importer.rb index 6b163cd1b2d835..f3253027d5750d 100644 --- a/lib/gitlab/bitbucket_server_import/importer.rb +++ b/lib/gitlab/bitbucket_server_import/importer.rb @@ -442,10 +442,9 @@ def author_id(rep_object) end def uid(rep_object) - # We want this explicit to only be username on the FF - # Otherwise, match email. - # There should be no default fall-through on username. Fall-through to import user - if Feature.enabled?(:bitbucket_server_user_mapping_by_username) + # We want this to only match either username or email depending on the flag state. + # There should be no fall-through. + if Feature.enabled?(:bitbucket_server_user_mapping_by_username, type: :ops) find_user_id(by: :username, value: rep_object.author_username) else find_user_id(by: :email, value: rep_object.author_email) diff --git a/lib/gitlab/bitbucket_server_import/user_finder.rb b/lib/gitlab/bitbucket_server_import/user_finder.rb index f96454eb2ccab9..68bd2d4851a513 100644 --- a/lib/gitlab/bitbucket_server_import/user_finder.rb +++ b/lib/gitlab/bitbucket_server_import/user_finder.rb @@ -24,7 +24,7 @@ def author_id(object) def uid(object) # We want this to only match either username or email depending on the flag state. # There should be no fall-through. - if Feature.enabled?(:bitbucket_server_user_mapping_by_username) + if Feature.enabled?(:bitbucket_server_user_mapping_by_username, type: :ops) find_user_id(by: :username, value: object.is_a?(Hash) ? object[:author_username] : object.author_username) else find_user_id(by: :email, value: object.is_a?(Hash) ? object[:author_email] : object.author_email) -- GitLab