summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzegorz@gitlab.com>2017-06-08 05:29:35 +0000
committerKamil TrzciƄski <ayufan@ayufan.eu>2018-02-28 20:00:27 +0100
commit52c3b8f31264230814d2ffa79d0987c1491676b3 (patch)
treed5827bc9bd891c1dd602eb3cdd4e4062d2e85589 /lib
parent64701b51aeacf4f4f932f205a2d831880b757a43 (diff)
downloadgitlab-ce-52c3b8f31264230814d2ffa79d0987c1491676b3.tar.gz
Merge branch 'zj-object-store-artifacts' into 'master'
Object store for artifacts Closes gitlab-ce#29203 See merge request !1762
Diffstat (limited to 'lib')
-rw-r--r--lib/api/helpers.rb2
-rw-r--r--lib/ci/api/builds.rb2
-rw-r--r--lib/tasks/gitlab/artifacts.rake19
3 files changed, 21 insertions, 2 deletions
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