diff options
Diffstat (limited to 'app/models/ci')
-rw-r--r-- | app/models/ci/job_artifact.rb | 22 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 6 |
2 files changed, 27 insertions, 1 deletions
diff --git a/app/models/ci/job_artifact.rb b/app/models/ci/job_artifact.rb index 17b7ee4f07e..93fc1b145b2 100644 --- a/app/models/ci/job_artifact.rb +++ b/app/models/ci/job_artifact.rb @@ -48,6 +48,20 @@ module Ci gzip: 3 } + # `file_location` indicates where actual files are stored. + # Ideally, actual files should be stored in the same directory, and use the same + # convention to generate its path. However, sometimes we can't do so due to backward-compatibility. + # + # legacy_path ... The actual file is stored at a path consists of a timestamp + # and raw project/model IDs. Those rows were migrated from + # `ci_builds.artifacts_file` and `ci_builds.artifacts_metadata` + # hashed_path ... The actual file is stored at a path consists of a SHA2 based on the project ID. + # This is the default value. + enum file_location: { + legacy_path: 1, + hashed_path: 2 + } + FILE_FORMAT_ADAPTERS = { gzip: Gitlab::Ci::Build::Artifacts::GzipFileAdapter }.freeze @@ -72,6 +86,12 @@ module Ci [nil, ::JobArtifactUploader::Store::LOCAL].include?(self.file_store) end + def hashed_path? + return true if trace? # ArchiveLegacyTraces background migration might not have `file_location` column + + super || self.file_location.nil? + end + def expire_in expire_at - Time.now if expire_at end @@ -108,7 +128,7 @@ module Ci end def update_project_statistics_after_destroy - update_project_statistics(-self.size) + update_project_statistics(-self.size.to_i) end def update_project_statistics(difference) diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 526bf7af99b..2955e0b2bca 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -161,6 +161,12 @@ module Ci PipelineNotificationWorker.perform_async(pipeline.id) end end + + after_transition any => [:failed] do |pipeline| + next unless pipeline.auto_devops_source? + + pipeline.run_after_commit { AutoDevops::DisableWorker.perform_async(pipeline.id) } + end end scope :internal, -> { where(source: internal_sources) } |