Commit 5a98e5e1 authored by Adam Hegyi's avatar Adam Hegyi

Merge branch 'add_missing_artifact_types_to_latest_pipeline_id_population_migration' into 'master'

Reschedule `latest_pipeline_id` population with all artifact types

See merge request gitlab-org/gitlab!67163
parents 4b5a8cce f22009e1
# 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