diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-21 10:08:36 +0300 |
commit | 48aff82709769b098321c738f3444b9bdaa694c6 (patch) | |
tree | e00c7c43e2d9b603a5a6af576b1685e400410dee /app/models/pages_deployment.rb | |
parent | 879f5329ee916a948223f8f43d77fba4da6cd028 (diff) |
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/models/pages_deployment.rb')
-rw-r--r-- | app/models/pages_deployment.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/pages_deployment.rb b/app/models/pages_deployment.rb index 78e0f185a11..cd952c32046 100644 --- a/app/models/pages_deployment.rb +++ b/app/models/pages_deployment.rb @@ -2,10 +2,24 @@ # PagesDeployment stores a zip archive containing GitLab Pages web-site class PagesDeployment < ApplicationRecord + include FileStoreMounter + belongs_to :project, optional: false belongs_to :ci_build, class_name: 'Ci::Build', optional: true validates :file, presence: true validates :file_store, presence: true, inclusion: { in: ObjectStorage::SUPPORTED_STORES } validates :size, presence: true, numericality: { greater_than: 0, only_integer: true } + + before_validation :set_size, if: :file_changed? + + default_value_for(:file_store) { ::Pages::DeploymentUploader.default_store } + + mount_file_store_uploader ::Pages::DeploymentUploader + + private + + def set_size + self.size = file.size + end end |