diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-01-09 11:21:07 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2019-01-09 11:21:07 +0300 |
commit | f7efb2e090e4fd07608a742722b4bd17c9bb7121 (patch) | |
tree | c9978899bfab60d3ad15a0fba67721e6cb1a4e60 /lib | |
parent | cfaa19f21ea4f01ef8e77fbacbdfd0e1b965a8aa (diff) | |
parent | 935dc667178673022cc221f92e5b59ddcd839eaf (diff) |
Merge branch 'refactor-artifact-api-endpoint' into 'master'
Refactor artifact api endpoint
Closes #55445
See merge request gitlab-org/gitlab-ce!23582
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/job_artifacts.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/api/job_artifacts.rb b/lib/api/job_artifacts.rb index a4068a200b3..933bd067e26 100644 --- a/lib/api/job_artifacts.rb +++ b/lib/api/job_artifacts.rb @@ -23,17 +23,14 @@ module API requires :job, type: String, desc: 'The name for the job' end route_setting :authentication, job_token_allowed: true - # rubocop: disable CodeReuse/ActiveRecord get ':id/jobs/artifacts/:ref_name/download', requirements: { ref_name: /.+/ } do authorize_download_artifacts! - builds = user_project.latest_successful_builds_for(params[:ref_name]) - latest_build = builds.find_by!(name: params[:job]) + latest_build = user_project.latest_successful_build_for!(params[:job], params[:ref_name]) present_carrierwave_file!(latest_build.artifacts_file) end - # rubocop: enable CodeReuse/ActiveRecord desc 'Download a specific file from artifacts archive from a ref' do detail 'This feature was introduced in GitLab 11.5' @@ -48,7 +45,7 @@ module API requirements: { ref_name: /.+/ } do authorize_download_artifacts! - build = user_project.latest_successful_build_for(params[:job], params[:ref_name]) + build = user_project.latest_successful_build_for!(params[:job], params[:ref_name]) path = Gitlab::Ci::Build::Artifacts::Path .new(params[:artifact_path]) |