diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-07 15:08:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-12-07 15:08:27 +0300 |
commit | e799c1393aaae58ace8f81141bd723b5d599c864 (patch) | |
tree | b01b974fdbc372b674e80cb09a32588c6aeb17bd /app/models | |
parent | 8228f6e154ed6b1884fab3fe5dc79a0552662d1b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 2 | ||||
-rw-r--r-- | app/models/ci/job_variable.rb | 3 | ||||
-rw-r--r-- | app/models/concerns/ci/partitionable.rb | 1 | ||||
-rw-r--r-- | app/models/packages/rpm/repository_file.rb | 10 |
4 files changed, 15 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 7e85337c21f..71ca09717d9 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -46,7 +46,7 @@ module Ci # DELETE queries when the Ci::Build is destroyed. The next step is to remove `dependent: :destroy`. # Details: https://gitlab.com/gitlab-org/gitlab/-/issues/24644#note_689472685 has_many :job_artifacts, class_name: 'Ci::JobArtifact', foreign_key: :job_id, dependent: :destroy, inverse_of: :job # rubocop:disable Cop/ActiveRecordDependent - has_many :job_variables, class_name: 'Ci::JobVariable', foreign_key: :job_id + has_many :job_variables, class_name: 'Ci::JobVariable', foreign_key: :job_id, inverse_of: :job has_many :sourced_pipelines, class_name: 'Ci::Sources::Pipeline', foreign_key: :source_job_id has_many :pages_deployments, inverse_of: :ci_build diff --git a/app/models/ci/job_variable.rb b/app/models/ci/job_variable.rb index 332a78b66ae..998f0647ad5 100644 --- a/app/models/ci/job_variable.rb +++ b/app/models/ci/job_variable.rb @@ -2,12 +2,15 @@ module Ci class JobVariable < Ci::ApplicationRecord + include Ci::Partitionable include Ci::NewHasVariable include Ci::RawVariable include BulkInsertSafe belongs_to :job, class_name: "Ci::Build", foreign_key: :job_id + partitionable scope: :job + alias_attribute :secret_value, :value validates :key, uniqueness: { scope: :job_id }, unless: :dotenv_source? diff --git a/app/models/concerns/ci/partitionable.rb b/app/models/concerns/ci/partitionable.rb index 6e01da2e9df..88692a735ba 100644 --- a/app/models/concerns/ci/partitionable.rb +++ b/app/models/concerns/ci/partitionable.rb @@ -32,6 +32,7 @@ module Ci Ci::BuildTraceMetadata Ci::BuildPendingState Ci::JobArtifact + Ci::JobVariable Ci::Pipeline Ci::PendingBuild Ci::RunningBuild diff --git a/app/models/packages/rpm/repository_file.rb b/app/models/packages/rpm/repository_file.rb index 4b5fa59c6ee..614ec9b3e56 100644 --- a/app/models/packages/rpm/repository_file.rb +++ b/app/models/packages/rpm/repository_file.rb @@ -8,6 +8,8 @@ module Packages include Packages::Installable INSTALLABLE_STATUSES = [:default].freeze + FILELISTS_FILENAME = 'filelists.xml' + FILELISTS_SIZE_LIMITATION = 20.megabytes enum status: { default: 0, pending_destruction: 1, processing: 2, error: 3 } @@ -20,6 +22,14 @@ module Packages mount_file_store_uploader Packages::Rpm::RepositoryFileUploader update_project_statistics project_statistics_name: :packages_size + + def self.has_oversized_filelists?(project_id:) + where( + project_id: project_id, + file_name: FILELISTS_FILENAME, + size: [FILELISTS_SIZE_LIMITATION..] + ).exists? + end end end end |