diff options
author | Rémy Coutable <remy@rymai.me> | 2016-07-04 15:36:02 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-04 15:36:02 +0000 |
commit | 1a36493d134328fa5b9ac3d3a04e43e72bdf67bb (patch) | |
tree | 4026f45db87f44eb77fa587852c2853929265e03 /app | |
parent | f60b48bdcb4762451618fe03bca98581282a0904 (diff) | |
parent | 36a73929df7cb47a428fb04740ee81f497327edb (diff) | |
download | gitlab-ce-1a36493d134328fa5b9ac3d3a04e43e72bdf67bb.tar.gz |
Merge branch 'save-artifacts_sizes' into 'master'
Save artifacts sizes
## What does this MR do?
Introduce ci_builds.artifacts_size as an integer, so that it's easier to access than reading from the file again.
## What are the relevant issue numbers?
Closes #18869
See merge request !4964
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/build.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index c11f8e6884d..5c973749975 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -19,6 +19,7 @@ module Ci acts_as_taggable + before_save :update_artifacts_size, if: :artifacts_file_changed? before_destroy { project } after_create :execute_hooks @@ -329,7 +330,12 @@ module Ci end def artifacts_metadata_entry(path, **options) - Gitlab::Ci::Build::Artifacts::Metadata.new(artifacts_metadata.path, path, **options).to_entry + metadata = Gitlab::Ci::Build::Artifacts::Metadata.new( + artifacts_metadata.path, + path, + **options) + + metadata.to_entry end def erase_artifacts! @@ -375,6 +381,14 @@ module Ci private + def update_artifacts_size + self.artifacts_size = if artifacts_file.exists? + artifacts_file.size + else + nil + end + end + def erase_trace! self.trace = nil end |