Commit f22009e1 authored by Mehmet Emin INAC's avatar Mehmet Emin INAC Committed by Adam Hegyi

Reschedule `latest_pipeline_id` population with all artifact types

Previous migration was missing the `api_fuzzing` artifact type by
mistake and durint the review process, `cluster_image_scanning` type
was introduced which also requires the migration.

Changelog: fixed
parent 2a83584c
# frozen_string_literal: true
class ReScheduleLatestPipelineIdPopulationWithLogging < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
DELAY_INTERVAL = 2.minutes.to_i
BATCH_SIZE = 100
MIGRATION = 'PopulateLatestPipelineIds'
disable_ddl_transaction!
def up
return unless Gitlab.ee?
Gitlab::BackgroundMigration.steal(MIGRATION)
queue_background_migration_jobs_by_range_at_intervals(
Gitlab::BackgroundMigration::PopulateLatestPipelineIds::ProjectSetting.has_vulnerabilities_without_latest_pipeline_set,
MIGRATION,
DELAY_INTERVAL,
batch_size: BATCH_SIZE,
primary_column_name: 'project_id'
)
# no-op: The content of the migration has been moved to
# `ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes`.
end
def down
......
# frozen_string_literal: true
class ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
DELAY_INTERVAL = 2.minutes.to_i
BATCH_SIZE = 100
MIGRATION = 'PopulateLatestPipelineIds'
disable_ddl_transaction!
def up
return unless Gitlab.ee?
Gitlab::BackgroundMigration.steal(MIGRATION)
queue_background_migration_jobs_by_range_at_intervals(
Gitlab::BackgroundMigration::PopulateLatestPipelineIds::ProjectSetting.has_vulnerabilities_without_latest_pipeline_set,
MIGRATION,
DELAY_INTERVAL,
batch_size: BATCH_SIZE,
primary_column_name: 'project_id'
)
end
def down
# no-op
end
end
94978b93b1590cb2cfd9536a44a8817aa485a35d5372dfed31041261f5e12406
\ No newline at end of file
......@@ -66,7 +66,9 @@ module EE
# dast: 8
# secret_detection: 21
# coverage_fuzzing: 23
FILE_TYPES = [5, 6, 7, 8, 21, 23].freeze
# api_fuzzing: 26
# cluster_image_scanning: 27
FILE_TYPES = [5, 6, 7, 8, 21, 23, 26, 27].freeze
LATEST_PIPELINE_WITH_REPORTS_SQL = <<~SQL
SELECT
"ci_pipelines"."id"
......
......@@ -3,7 +3,7 @@
require 'spec_helper'
require_migration!
RSpec.describe ReScheduleLatestPipelineIdPopulationWithLogging do
RSpec.describe ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes do
let(:namespaces) { table(:namespaces) }
let(:pipelines) { table(:ci_pipelines) }
let(:projects) { table(:projects) }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment