Commit 21d53985 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'delete-pages' into 'master'

Delete artifacts for pages unless expiry date is specified

See merge request !9716
parents ae8a0665 8f227f23
...@@ -34,6 +34,8 @@ module Projects ...@@ -34,6 +34,8 @@ module Projects
end end
rescue => e rescue => e
error(e.message) error(e.message)
ensure
build.erase_artifacts! unless build.has_expiring_artifacts?
end end
private private
......
---
title: Delete artifacts for pages unless expiry date is specified
merge_request: 9716
author:
...@@ -133,6 +133,9 @@ your Jekyll 3.4.0 site with GitLab Pages. This is the minimum ...@@ -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 configuration for our example. On the steps below, we'll refine
the script by adding extra options to our GitLab CI. 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 the expiry time.
### Image ### Image
At this point, you probably ask yourself: "okay, but to install Jekyll At this point, you probably ask yourself: "okay, but to install Jekyll
......
...@@ -26,6 +26,28 @@ describe Projects::UpdatePagesService do ...@@ -26,6 +26,28 @@ describe Projects::UpdatePagesService do
build.update_attributes(artifacts_metadata: metadata) build.update_attributes(artifacts_metadata: metadata)
end end
describe 'pages 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 it 'succeeds' do
expect(project.pages_deployed?).to be_falsey expect(project.pages_deployed?).to be_falsey
expect(execute).to eq(:success) 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