diff options
author | Nick Thomas <nick@gitlab.com> | 2019-03-13 13:42:43 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-03-13 13:42:43 +0000 |
commit | 9f05e97aad33a0cd70862f67101bdcb3fddc639a (patch) | |
tree | a9868d2c6711ebff1dcbb06f6d09f91d15caa631 /lib/tasks | |
parent | 5ed9c5f7f74d7305bb884a6ae7a601d4563398a4 (diff) | |
download | gitlab-ce-9f05e97aad33a0cd70862f67101bdcb3fddc639a.tar.gz |
Run rubocop -a
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/gitlab/artifacts/migrate.rake | 13 | ||||
-rw-r--r-- | lib/tasks/gitlab/lfs/migrate.rake | 11 | ||||
-rw-r--r-- | lib/tasks/gitlab/traces.rake | 11 | ||||
-rw-r--r-- | lib/tasks/lint.rake | 8 | ||||
-rw-r--r-- | lib/tasks/migrate/migrate_iids.rake | 42 |
5 files changed, 37 insertions, 48 deletions
diff --git a/lib/tasks/gitlab/artifacts/migrate.rake b/lib/tasks/gitlab/artifacts/migrate.rake index e7634d2ed4f..9012e55a70c 100644 --- a/lib/tasks/gitlab/artifacts/migrate.rake +++ b/lib/tasks/gitlab/artifacts/migrate.rake @@ -11,14 +11,13 @@ namespace :gitlab do Ci::Build.joins(:project) .with_artifacts_stored_locally .find_each(batch_size: 10) do |build| - begin - build.artifacts_file.migrate!(ObjectStorage::Store::REMOTE) - build.artifacts_metadata.migrate!(ObjectStorage::Store::REMOTE) - logger.info("Transferred artifact ID #{build.id} with size #{build.artifacts_size} to object storage") - rescue => e - logger.error("Failed to transfer artifacts of #{build.id} with error: #{e.message}") - end + build.artifacts_file.migrate!(ObjectStorage::Store::REMOTE) + build.artifacts_metadata.migrate!(ObjectStorage::Store::REMOTE) + + logger.info("Transferred artifact ID #{build.id} with size #{build.artifacts_size} to object storage") + rescue => e + logger.error("Failed to transfer artifacts of #{build.id} with error: #{e.message}") end end end diff --git a/lib/tasks/gitlab/lfs/migrate.rake b/lib/tasks/gitlab/lfs/migrate.rake index a45e5ca91e0..97c15175a23 100644 --- a/lib/tasks/gitlab/lfs/migrate.rake +++ b/lib/tasks/gitlab/lfs/migrate.rake @@ -9,13 +9,12 @@ namespace :gitlab do LfsObject.with_files_stored_locally .find_each(batch_size: 10) do |lfs_object| - begin - lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE) - logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage") - rescue => e - logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}") - end + lfs_object.file.migrate!(LfsObjectUploader::Store::REMOTE) + + logger.info("Transferred LFS object #{lfs_object.oid} of size #{lfs_object.size.to_i.bytes} to object storage") + rescue => e + logger.error("Failed to transfer LFS object #{lfs_object.oid} with error: #{e.message}") end end end diff --git a/lib/tasks/gitlab/traces.rake b/lib/tasks/gitlab/traces.rake index 5a232091a7e..5e1ec481ece 100644 --- a/lib/tasks/gitlab/traces.rake +++ b/lib/tasks/gitlab/traces.rake @@ -26,13 +26,12 @@ namespace :gitlab do Ci::Build.joins(:project) .with_archived_trace_stored_locally .find_each(batch_size: 10) do |build| - begin - build.job_artifacts_trace.file.migrate!(ObjectStorage::Store::REMOTE) - logger.info("Transferred job trace of #{build.id} to object storage") - rescue => e - logger.error("Failed to transfer artifacts of #{build.id} with error: #{e.message}") - end + build.job_artifacts_trace.file.migrate!(ObjectStorage::Store::REMOTE) + + logger.info("Transferred job trace of #{build.id} to object storage") + rescue => e + logger.error("Failed to transfer artifacts of #{build.id} with error: #{e.message}") end end end diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake index 5d673a1a285..c5d0f2c292f 100644 --- a/lib/tasks/lint.rake +++ b/lib/tasks/lint.rake @@ -19,11 +19,9 @@ unless Rails.env.production? desc "GitLab | lint | Lint HAML files" task :haml do - begin - Rake::Task['haml_lint'].invoke - rescue RuntimeError # The haml_lint tasks raise a RuntimeError - exit(1) - end + Rake::Task['haml_lint'].invoke + rescue RuntimeError # The haml_lint tasks raise a RuntimeError + exit(1) end desc "GitLab | lint | Run several lint checks" diff --git a/lib/tasks/migrate/migrate_iids.rake b/lib/tasks/migrate/migrate_iids.rake index aa2d01730d7..cb7c496c31c 100644 --- a/lib/tasks/migrate/migrate_iids.rake +++ b/lib/tasks/migrate/migrate_iids.rake @@ -2,49 +2,43 @@ desc "GitLab | Build internal ids for issues and merge requests" task migrate_iids: :environment do puts 'Issues'.color(:yellow) Issue.where(iid: nil).find_each(batch_size: 100) do |issue| - begin - issue.set_iid + issue.set_iid - if issue.update_attribute(:iid, issue.iid) - print '.' - else - print 'F' - end - rescue + if issue.update_attribute(:iid, issue.iid) + print '.' + else print 'F' end + rescue + print 'F' end puts 'done' puts 'Merge Requests'.color(:yellow) MergeRequest.where(iid: nil).find_each(batch_size: 100) do |mr| - begin - mr.set_iid + mr.set_iid - if mr.update_attribute(:iid, mr.iid) - print '.' - else - print 'F' - end - rescue + if mr.update_attribute(:iid, mr.iid) + print '.' + else print 'F' end + rescue + print 'F' end puts 'done' puts 'Milestones'.color(:yellow) Milestone.where(iid: nil).find_each(batch_size: 100) do |m| - begin - m.set_iid + m.set_iid - if m.update_attribute(:iid, m.iid) - print '.' - else - print 'F' - end - rescue + if m.update_attribute(:iid, m.iid) + print '.' + else print 'F' end + rescue + print 'F' end puts 'done' |