diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-06 01:14:02 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2017-03-06 01:34:20 +0300 |
commit | 829cc80e1d9147721f6edc137c52ed91500c931e (patch) | |
tree | c161aeac1405f366a3e35336ee13bf837c2a38ae | |
parent | 8a5557ce514fc5bd1a8e4e236713fd0910ce7e78 (diff) |
Delete artifacts for pages unless expiry date is specified
4 files changed, 29 insertions, 0 deletions
diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index 2d42c4fc04a..523b9f41916 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -34,6 +34,8 @@ module Projects end rescue => e error(e.message) + ensure + build.erase_artifacts! unless build.has_expiring_artifacts? end private diff --git a/changelogs/unreleased/delete-artifacts-for-pages.yml b/changelogs/unreleased/delete-artifacts-for-pages.yml new file mode 100644 index 00000000000..3963a2e5014 --- /dev/null +++ b/changelogs/unreleased/delete-artifacts-for-pages.yml @@ -0,0 +1,4 @@ +--- +title: Delete artifacts for pages unless expiry date is specified +merge_request: +author: diff --git a/doc/user/project/pages/getting_started_part_four.md b/doc/user/project/pages/getting_started_part_four.md index 6edf99239ea..83f88fbeb40 100644 --- a/doc/user/project/pages/getting_started_part_four.md +++ b/doc/user/project/pages/getting_started_part_four.md @@ -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 diff --git a/spec/services/projects/update_pages_service_spec.rb b/spec/services/projects/update_pages_service_spec.rb index 411b22a0fb8..6c583f18a9c 100644 --- a/spec/services/projects/update_pages_service_spec.rb +++ b/spec/services/projects/update_pages_service_spec.rb @@ -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) |