diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline_metadata.rb | 8 | ||||
-rw-r--r-- | app/models/concerns/cached_commit.rb | 4 | ||||
-rw-r--r-- | app/models/merge_request_context_commit.rb | 7 | ||||
-rw-r--r-- | app/models/merge_request_diff_commit.rb | 7 | ||||
-rw-r--r-- | app/models/vulnerability.rb | 4 | ||||
-rw-r--r-- | app/workers/concerns/gitlab/github_import/rescheduling_methods.rb | 6 |
6 files changed, 31 insertions, 5 deletions
diff --git a/app/models/ci/pipeline_metadata.rb b/app/models/ci/pipeline_metadata.rb index 2bd206c5ca5..5457fb899b0 100644 --- a/app/models/ci/pipeline_metadata.rb +++ b/app/models/ci/pipeline_metadata.rb @@ -4,11 +4,17 @@ module Ci class PipelineMetadata < Ci::ApplicationRecord self.primary_key = :pipeline_id + enum auto_cancel_on_new_commit: { + conservative: 0, + interruptible: 1, + disabled: 2 + }, _prefix: true + belongs_to :pipeline, class_name: "Ci::Pipeline", inverse_of: :pipeline_metadata belongs_to :project, class_name: "Project", inverse_of: :pipeline_metadata validates :pipeline, presence: true validates :project, presence: true - validates :name, presence: true, length: { minimum: 1, maximum: 255 } + validates :name, length: { minimum: 1, maximum: 255 }, allow_nil: true end end diff --git a/app/models/concerns/cached_commit.rb b/app/models/concerns/cached_commit.rb index 8a53fec0612..74120f49d01 100644 --- a/app/models/concerns/cached_commit.rb +++ b/app/models/concerns/cached_commit.rb @@ -19,4 +19,8 @@ module CachedCommit def referenced_by [] end + + def extended_trailers + {} + end end diff --git a/app/models/merge_request_context_commit.rb b/app/models/merge_request_context_commit.rb index 281e11c7c13..921ad7e1f0a 100644 --- a/app/models/merge_request_context_commit.rb +++ b/app/models/merge_request_context_commit.rb @@ -26,6 +26,13 @@ class MergeRequestContextCommit < ApplicationRecord # create MergeRequestContextCommit by given commit sha and it's diff file record def self.bulk_insert(rows, **args) + # Remove the new extended_trailers attribute as this shouldn't be + # inserted into the database. This will be removed once the old + # format of the trailers attribute is deprecated. + rows = rows.map do |row| + row.except(:extended_trailers).to_hash + end + ApplicationRecord.legacy_bulk_insert('merge_request_context_commits', rows, **args) # rubocop:disable Gitlab/BulkInsert end diff --git a/app/models/merge_request_diff_commit.rb b/app/models/merge_request_diff_commit.rb index 790520c4123..d0d9f173346 100644 --- a/app/models/merge_request_diff_commit.rb +++ b/app/models/merge_request_diff_commit.rb @@ -53,8 +53,13 @@ class MergeRequestDiffCommit < ApplicationRecord # These fields are only used to determine the author/committer IDs, we # don't store them in the DB. + # + # Trailers are stored in the DB here in order to allow changelog parsing. + # Rather than add an additional column for :extended_trailers, we're instead + # ignoring it for now until we deprecate the :trailers field and replace it with + # the new functionality. commit_hash = commit_hash - .except(:author_name, :author_email, :committer_name, :committer_email) + .except(:author_name, :author_email, :committer_name, :committer_email, :extended_trailers) commit_hash.merge( commit_author_id: author.id, diff --git a/app/models/vulnerability.rb b/app/models/vulnerability.rb index 6bf63bab82c..c8f9e75a389 100644 --- a/app/models/vulnerability.rb +++ b/app/models/vulnerability.rb @@ -5,8 +5,8 @@ class Vulnerability < ApplicationRecord include EachBatch include IgnorableColumns - ignore_column %i[due_date epic_id milestone_id last_edited_at last_edited_by_id - start_date start_date_sourcing_milestone_id updated_by_id], + ignore_column %i[due_date due_date_sourcing_milestone_id epic_id milestone_id + last_edited_at last_edited_by_id start_date start_date_sourcing_milestone_id updated_by_id], remove_with: '16.9', remove_after: '2024-01-19' diff --git a/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb b/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb index 316d30d94da..e2808f45821 100644 --- a/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb +++ b/app/workers/concerns/gitlab/github_import/rescheduling_methods.rb @@ -8,6 +8,8 @@ module Gitlab extend ActiveSupport::Concern include JobDelayCalculator + attr_reader :project + ENQUEUED_JOB_COUNT = 'github-importer/enqueued_job_count/%{project}/%{collection}' included do @@ -17,8 +19,10 @@ module Gitlab # project_id - The ID of the GitLab project to import the note into. # hash - A Hash containing the details of the GitHub object to import. # notify_key - The Redis key to notify upon completion, if any. + def perform(project_id, hash, notify_key = nil) - project = Project.find_by_id(project_id) + @project = Project.find_by_id(project_id) # rubocop:disable Gitlab/ModuleWithInstanceVariables -- GitHub Import + # uses modules everywhere. Too big to refactor. return notify_waiter(notify_key) unless project |