From 52c3b8f31264230814d2ffa79d0987c1491676b3 Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Thu, 8 Jun 2017 05:29:35 +0000 Subject: Merge branch 'zj-object-store-artifacts' into 'master' Object store for artifacts Closes gitlab-ce#29203 See merge request !1762 --- lib/api/helpers.rb | 2 +- lib/ci/api/builds.rb | 2 +- lib/tasks/gitlab/artifacts.rake | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 lib/tasks/gitlab/artifacts.rake (limited to 'lib') diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 0f4791841d2..7003390113b 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -318,7 +318,7 @@ module API if artifacts_file.file_storage? present_file!(artifacts_file.path, artifacts_file.filename) else - redirect_to(artifacts_file.url) + redirect(artifacts_file.url) end end diff --git a/lib/ci/api/builds.rb b/lib/ci/api/builds.rb index e2e91ce99cd..ecbdfb3e4b2 100644 --- a/lib/ci/api/builds.rb +++ b/lib/ci/api/builds.rb @@ -192,7 +192,7 @@ module Ci end unless artifacts_file.file_storage? - return redirect_to build.artifacts_file.url + return redirect(build.artifacts_file.url) end present_file!(artifacts_file.path, artifacts_file.filename) diff --git a/lib/tasks/gitlab/artifacts.rake b/lib/tasks/gitlab/artifacts.rake new file mode 100644 index 00000000000..5676456b2a0 --- /dev/null +++ b/lib/tasks/gitlab/artifacts.rake @@ -0,0 +1,19 @@ +desc "GitLab | Migrate files for artifacts to comply with new storage format" +namespace :gitlab do + namespace :artifacts do + task migrate: :environment do + puts 'Artifacts'.color(:yellow) + Ci::Build.joins(:project).with_artifacts + .where(artifacts_file_store: ArtifactUploader::LOCAL_STORE) + .find_each(batch_size: 100) do |issue| + begin + build.artifacts_file.migrate!(ArtifactUploader::REMOTE_STORE) + build.artifacts_metadata.migrate!(ArtifactUploader::REMOTE_STORE) + print '.' + rescue + print 'F' + end + end + end + end +end -- cgit v1.2.1