diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index 15f80808a0d7fba3439f2b8b20056246b8aab659..f60eba39450f785a1a6506f28c27251f95d17044 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -1171,7 +1171,7 @@ # Gitlab.ee do Settings['cloud_connector'] = {} - Settings.cloud_connector['base_url'] ||= ENV['CLOUD_CONNECTOR_BASE_URL'] || 'https://cloud.gitlab.com' + Settings.cloud_connector['base_url'] ||= 'https://cloud.gitlab.com' end # diff --git a/ee/app/services/cloud_connector/status_checks/status_service.rb b/ee/app/services/cloud_connector/status_checks/status_service.rb index 4a3bfc95c0124dbc5c777113ee0d529768cddd3f..88db21af95cdc3f26fdea6a58c84a67aad81ff40 100644 --- a/ee/app/services/cloud_connector/status_checks/status_service.rb +++ b/ee/app/services/cloud_connector/status_checks/status_service.rb @@ -29,11 +29,11 @@ def execute private def selected_probes - if ::Gitlab::Utils.to_boolean(ENV['CLOUD_CONNECTOR_SELF_SIGN_TOKENS']) + if cloud_connector_development? development_probes # We consider the instance to be using self-hosted Duo # if they register a self-hosted AIGW URL. - elsif ::Gitlab::AiGateway.self_hosted_url.present? + elsif self_hosted_models_setup? ::Gitlab::Ai::SelfHosted::AiGateway.probes(@user) elsif ::Ai::AmazonQ.connected? default_probes + amazon_q_probes @@ -42,6 +42,17 @@ def selected_probes end end + def cloud_connector_development? + Rails.env.development? && ( + ::Gitlab::Utils.to_boolean(ENV['CLOUD_CONNECTOR_SELF_SIGN_TOKENS']) || + ENV['CLOUD_CONNECTOR_BASE_URL'].present? + ) + end + + def self_hosted_models_setup? + ::Gitlab::AiGateway.self_hosted_url.present? + end + def default_probes [ CloudConnector::StatusChecks::Probes::LicenseProbe.new, @@ -56,7 +67,7 @@ def default_probes # Carries out minimal checks for development and testing purposes def development_probes [ - CloudConnector::StatusChecks::Probes::HostProbe.new(::Gitlab::AiGateway.self_hosted_url), + CloudConnector::StatusChecks::Probes::HostProbe.new(CLOUD_CONNECTOR_URL), CloudConnector::StatusChecks::Probes::EndToEndProbe.new(@user) ] end diff --git a/ee/lib/api/security_scans.rb b/ee/lib/api/security_scans.rb index bd92c636249b00998abe35135f2237bfcdf5767b..5e1aa52da7f65ab0d1fd8963f214e6e1f5adac20 100644 --- a/ee/lib/api/security_scans.rb +++ b/ee/lib/api/security_scans.rb @@ -15,6 +15,7 @@ class SecurityScans < ::API::Base helpers do def construct_scan_url(endpoint) + # TODO: This will be broken now when setting CLOUD_CONNECTOR_BASE_URL to a local SAST Scanner instance scanner_service_url = ENV.fetch('SCANNER_SERVICE_URL', "#{::CloudConnector::Config.base_url}/sast") "#{scanner_service_url}/#{endpoint}" end diff --git a/ee/lib/cloud_connector/config.rb b/ee/lib/cloud_connector/config.rb index 827c6637eaf8fd513a0d9391e5564366e3eb1272..0b11facd2c8b816b75785fb5a3a6d906e1dfb437 100644 --- a/ee/lib/cloud_connector/config.rb +++ b/ee/lib/cloud_connector/config.rb @@ -6,7 +6,7 @@ module Config include Gitlab::Utils::StrongMemoize def base_url - Gitlab.config.cloud_connector.base_url + ENV['CLOUD_CONNECTOR_BASE_URL'] || Gitlab.config.cloud_connector.base_url end def host diff --git a/ee/lib/gitlab/ai_gateway.rb b/ee/lib/gitlab/ai_gateway.rb index 0104b5fa2a76d2016264b439115025a770d25558..3ee5697fa29db219fe3317a10666911403ca1805 100644 --- a/ee/lib/gitlab/ai_gateway.rb +++ b/ee/lib/gitlab/ai_gateway.rb @@ -15,7 +15,7 @@ def self.url end def self.cloud_connector_url - "#{::CloudConnector::Config.base_url}/ai" + ENV['CLOUD_CONNECTOR_BASE_URL'] || "#{::CloudConnector::Config.base_url}/ai" end def self.cloud_connector_auth_url