[Proposal] Uniformly access 'gitlab_realm' as a static helper available in CloudConnector namespace
Context
We have two places where we define gitlab_realm
:
- In
ee/lib/api/helpers/cloud_connector.rb
: https://gitlab.com/gitlab-org/gitlab/-/blob/4255c41510b005dfc2b246809a5a12bf20f1200d/ee/lib/api/helpers/cloud_connector.rb#L18 - Then we re-define it
ee/lib/api/code_suggestions.rb
: https://gitlab.com/gitlab-org/gitlab/-/blob/2856b5104a7d3974768111311d045f1930e7c2a5/ee/lib/api/code_suggestions.rb#L70 - this is the "exception", when the realm is not defined solely by the instance type (SaaS/SM).
Then gitlab_realm
is passed into CloudConnector::AccessService#access_token
.
Intent
Ideally:
-
gitlab_realm
should be a static function only defined by the instance type (SaaS vs SM). -
gitlab_realm
should belong to a broadercloud_connector
namespace (not limited to theapi/helpers
) - we should not pass
gitlab_realm
intoCloudConnector::AccessService#access_token
but instead access the function from inside theCloudConnector::AccessService
The goal
We should look for a better way to define and access gitlab_realm
in Cloud Connector-related code (or decide to keep it as-is and close the issue).
Potential blocker: To achieve this, we need to drop access_code_suggestions_when_proxied_to_saas?
and related logic: https://gitlab.com/gitlab-org/gitlab/-/blob/2856b5104a7d3974768111311d045f1930e7c2a5/ee/lib/api/code_suggestions.rb#L58 - https://gitlab.com/gitlab-org/gitlab/-/issues/439587
Edited by Aleksei Lipniagov