Skip to content
Snippets Groups Projects
Commit 9d8dca08 authored by Lin Jen-Shin's avatar Lin Jen-Shin
Browse files
parent 1bc0d732
No related branches found
No related tags found
1 merge request!4964Save artifacts sizes
Pipeline #
Loading
Loading
@@ -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
Loading
Loading
@@ -340,7 +341,6 @@ module Ci
def erase_artifacts!
remove_artifacts_file!
remove_artifacts_metadata!
self.artifacts_size = nil
save
end
 
Loading
Loading
@@ -381,6 +381,10 @@ module Ci
 
private
 
def update_artifacts_size
self.artifacts_size = artifacts_file.size
end
def erase_trace!
self.trace = nil
end
Loading
Loading
Loading
Loading
@@ -147,7 +147,6 @@ module Ci
build.artifacts_file = artifacts
build.artifacts_metadata = metadata
build.artifacts_expire_in = params['expire_in']
build.artifacts_size = artifacts.size
 
if build.save
present(build, with: Entities::BuildDetails)
Loading
Loading
Loading
Loading
@@ -476,13 +476,17 @@ describe Ci::API::API do
 
describe 'DELETE /builds/:id/artifacts' do
let(:build) { create(:ci_build, :artifacts) }
before { delete delete_url, token: build.token }
before do
delete delete_url, token: build.token
build.reload
end
 
it 'should remove build artifacts' do
expect(response).to have_http_status(200)
expect(build.artifacts_file.exists?).to be_falsy
expect(build.artifacts_metadata.exists?).to be_falsy
expect(build.artifacts_size).to be_falsy
expect(build.artifacts_size).to eq(0)
end
end
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment