diff options
| author | Micaël Bergeron <mbergeron@gitlab.com> | 2018-03-09 10:31:31 -0500 |
|---|---|---|
| committer | Micaël Bergeron <mbergeron@gitlab.com> | 2018-03-09 10:31:31 -0500 |
| commit | f7b8ae3fe2adc95f18f779d737e60eac45a14223 (patch) | |
| tree | e4a69fe0ea45085e2161729111f99ff94f5a3a03 /app | |
| parent | 6466739e2e61f790a9e1f09020dba710c4078a0f (diff) | |
| download | gitlab-ce-f7b8ae3fe2adc95f18f779d737e60eac45a14223.tar.gz | |
apply feedback
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/ci/build.rb | 1 | ||||
| -rw-r--r-- | app/services/projects/update_pages_service.rb | 21 | ||||
| -rw-r--r-- | app/views/projects/jobs/_sidebar.html.haml | 6 | ||||
| -rw-r--r-- | app/workers/all_queues.yml | 2 |
4 files changed, 16 insertions, 14 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 715ab55a100..0056b329f40 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -51,7 +51,6 @@ module Ci scope :with_artifacts_not_expired, ->() { with_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.now) } scope :with_expired_artifacts, ->() { with_artifacts.where('artifacts_expire_at < ?', Time.now) } - scope :with_artifacts_stored_locally, ->() { with_artifacts.where(artifacts_file_store: [nil, LegacyArtifactUploader::Store::LOCAL]) } scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + [:manual]) } scope :ref_protected, -> { where(protected: true) } diff --git a/app/services/projects/update_pages_service.rb b/app/services/projects/update_pages_service.rb index baec2cbf4f5..5bf8208e035 100644 --- a/app/services/projects/update_pages_service.rb +++ b/app/services/projects/update_pages_service.rb @@ -71,9 +71,9 @@ module Projects end def extract_archive!(temp_path) - if artifacts_filename.ends_with?('.tar.gz') || artifacts_filename.ends_with?('.tgz') + if artifacts.ends_with?('.tar.gz') || artifacts.ends_with?('.tgz') extract_tar_archive!(temp_path) - elsif artifacts_filename.ends_with?('.zip') + elsif artifacts.ends_with?('.zip') extract_zip_archive!(temp_path) else raise FailedToExtractError, 'unsupported artifacts format' @@ -86,7 +86,7 @@ module Projects %W(dd bs=#{BLOCK_SIZE} count=#{blocks}), %W(tar -x -C #{temp_path} #{SITE_PATH}), err: '/dev/null') - raise 'pages failed to extract' unless results.compact.all?(&:success?) + raise FailedToExtractError, 'pages failed to extract' unless results.compact.all?(&:success?) end end @@ -107,7 +107,7 @@ module Projects site_path = File.join(SITE_PATH, '*') build.artifacts_file.use_file do |artifacts_path| unless system(*%W(unzip -n #{artifacts_path} #{site_path} -d #{temp_path})) - raise 'pages failed to extract' + raise FailedToExtractError, 'pages failed to extract' end end end @@ -139,10 +139,6 @@ module Projects 1 + max_size / BLOCK_SIZE end - def artifacts_filename - build.artifacts_file.filename - end - def max_size max_pages_size = Gitlab::CurrentSettings.max_pages_size.megabytes @@ -171,6 +167,15 @@ module Projects build.ref end + def artifacts + build.artifacts_file.path + end + + def delete_artifact! + build.reload # Reload stable object to prevent erase artifacts with old state + build.erase_artifacts! unless build.has_expiring_artifacts? + end + def latest_sha project.commit(build.ref).try(:sha).to_s end diff --git a/app/views/projects/jobs/_sidebar.html.haml b/app/views/projects/jobs/_sidebar.html.haml index 2a341569fb5..a159a9ef08e 100644 --- a/app/views/projects/jobs/_sidebar.html.haml +++ b/app/views/projects/jobs/_sidebar.html.haml @@ -35,9 +35,9 @@ = link_to download_project_job_artifacts_path(@project, @build), rel: 'nofollow', download: '', class: 'btn btn-sm btn-default' do Download - - if @build.browsable_artifacts? - = link_to browse_project_job_artifacts_path(@project, @build), class: 'btn btn-sm btn-default' do - Browse + - if @build.browsable_artifacts? + = link_to browse_project_job_artifacts_path(@project, @build), class: 'btn btn-sm btn-default' do + Browse - if @build.trigger_request .build-widget.block diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index cf3735460b2..9a11cdb121e 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -108,5 +108,3 @@ - update_user_activity - upload_checksum - web_hook - - |
