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 # frozen_string_literal: true
class ReScheduleLatestPipelineIdPopulationWithLogging < ActiveRecord::Migration[6.1] 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 def up
return unless Gitlab.ee? # no-op: The content of the migration has been moved to
# `ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes`.
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 end
def down 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 ...@@ -66,7 +66,9 @@ module EE
# dast: 8 # dast: 8
# secret_detection: 21 # secret_detection: 21
# coverage_fuzzing: 23 # 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 LATEST_PIPELINE_WITH_REPORTS_SQL = <<~SQL
SELECT SELECT
"ci_pipelines"."id" "ci_pipelines"."id"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
require_migration! require_migration!
RSpec.describe ReScheduleLatestPipelineIdPopulationWithLogging do RSpec.describe ReScheduleLatestPipelineIdPopulationWithAllSecurityRelatedArtifactTypes do
let(:namespaces) { table(:namespaces) } let(:namespaces) { table(:namespaces) }
let(:pipelines) { table(:ci_pipelines) } let(:pipelines) { table(:ci_pipelines) }
let(:projects) { table(:projects) } 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