Commit 829cc80e authored by Kamil Trzcinski's avatar Kamil Trzcinski

Delete artifacts for pages unless expiry date is specified

parent 8a5557ce
......@@ -34,6 +34,8 @@ module Projects
end
rescue => e
error(e.message)
ensure
build.erase_artifacts! unless build.has_expiring_artifacts?
end
private
......
---
title: Delete artifacts for pages unless expiry date is specified
merge_request:
author:
......@@ -133,6 +133,9 @@ your Jekyll 3.4.0 site with GitLab Pages. This is the minimum
configuration for our example. On the steps below, we'll refine
the script by adding extra options to our GitLab CI.
Artifacts will be automatically deleted once GitLab Pages got deployed.
You can preserve artifacts for limited time by specifying expiry time.
### Image
At this point, you probably ask yourself: "okay, but to install Jekyll
......
......@@ -26,6 +26,26 @@ describe Projects::UpdatePagesService do
build.update_attributes(artifacts_metadata: metadata)
end
context 'artifacts' do
context 'with expiry date' do
before do
build.artifacts_expire_in = "2 days"
end
it "doesn't delete artifacts" do
expect(execute).to eq(:success)
expect(build.reload.artifacts_file?).to eq(true)
end
end
context 'without expiry date' do
it "does delete artifacts" do
expect(execute).to eq(:success)
expect(build.reload.artifacts_file?).to eq(false)
end
end
end
it 'succeeds' do
expect(project.pages_deployed?).to be_falsey
expect(execute).to eq(:success)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment