diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 18:09:49 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-07 18:09:49 +0300 |
commit | 84f9f0cb8137637708a41152347e7754c1e9fb83 (patch) | |
tree | 6db9d8931bdb3c5b932b36345373936e2a543126 /app/models | |
parent | 75f809a2ff829574ab91628407993187d55e14a4 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/job_artifact.rb | 7 | ||||
-rw-r--r-- | app/models/environment.rb | 10 |
2 files changed, 16 insertions, 1 deletions
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 0dca5b18a24..b5622959c75 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -141,8 +141,11 @@ module Ci before_save :set_size, if: :file_changed? after_save :store_file_in_transaction!, unless: :store_after_commit? + after_commit :store_file_after_transaction!, on: [:create, :update], if: :store_after_commit? + after_destroy_commit :log_destroy + validates :job, presence: true validates :file_format, presence: true, unless: :trace?, on: :create validate :validate_file_format!, unless: :trace?, on: :create @@ -384,6 +387,10 @@ module Ci # Use job.project to avoid extra DB query for project job.project.pending_delete? end + + def log_destroy + Gitlab::Ci::Artifacts::Logger.log_deleted(self, __method__) + end end end diff --git a/app/models/environment.rb b/app/models/environment.rb index 7d99f10822d..7febafc2cca 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -74,7 +74,11 @@ class Environment < ApplicationRecord # Currently, the tier presence is validaed for newly created environments. # After the `BackfillEnvironmentTiers` background migration has been completed, we should remove `on: :create`. # See https://gitlab.com/gitlab-org/gitlab/-/issues/385253. - validates :tier, presence: true, on: :create + # Todo: Remove along with FF `validate_environment_tier_presence`. + validates :tier, presence: true, on: :create, unless: :validate_environment_tier_present? + + validates :tier, presence: true, if: :validate_environment_tier_present? + validate :safe_external_url validate :merge_request_not_changed @@ -600,6 +604,10 @@ class Environment < ApplicationRecord self.class.tiers[:other] end end + + def validate_environment_tier_present? + Feature.enabled?(:validate_environment_tier_presence, self.project) + end end Environment.prepend_mod_with('Environment') |