diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/helpers.rb | 2 | ||||
-rw-r--r-- | lib/ci/api/builds.rb | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/artifacts.rake | 19 |
3 files changed, 21 insertions, 2 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index 99b8b62691f..4056d06bcc7 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -324,7 +324,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 79058c02ce5..812ba8ed603 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 |