Class: Gitlab::BackgroundMigration::BackfillIntegrationsEnableSslVerification

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification.rb

Overview

Enable SSL verification for CI integrations with known-good hostnames.

Defined Under Namespace

Classes: Integration

Constant Summary collapse

INTEGRATIONS =
{
  # This matches the logic in `Integrations::DroneCi#url_is_saas?`
  # - https://gitlab.com/gitlab-org/gitlab/blob/65b7fc1ad1ad33247890324e9a3396993b7718a1/app/models/integrations/drone_ci.rb#L122-127
  # - https://docs.drone.io/pipeline/environment/reference/drone-system-hostname/
  'Integrations::DroneCi' => [
    :drone_url,
    /\Acloud\.drone\.io\z/i
  ],
  # This matches the logic in `Integrations::Teamcity#url_is_saas?`
  # - https://gitlab.com/gitlab-org/gitlab/blob/65b7fc1ad1ad33247890324e9a3396993b7718a1/app/models/integrations/teamcity.rb#L117-122
  # - https://www.jetbrains.com/help/teamcity/cloud/migrate-from-teamcity-on-premises-to-teamcity-cloud.html#Migration+Process
  'Integrations::Teamcity' => [
    :teamcity_url,
    /\A[^\.]+\.teamcity\.com\z/i
  ]

  # Other CI integrations which don't seem to have a SaaS offering:
  # - Atlassian Bamboo (the SaaS offering is Bitbucket Pipelines)
  # - Jenkins (self-hosted only)
  # - MockCi (development only)
}.freeze

Instance Method Summary collapse

Instance Method Details

#perform(start_id, stop_id) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/gitlab/background_migration/backfill_integrations_enable_ssl_verification.rb', line 61

def perform(start_id, stop_id)
  integration_ids = Integration
    .affected
    .where(id: (start_id..stop_id))
    .pluck(:id)

  integration_ids.each do |id|
    Integration.transaction do
      integration = Integration.lock.find(id)
      process_integration(integration)
    end
  end

  mark_job_as_succeeded(start_id, stop_id)
end