Commit a67aeaf1 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'fix/locked-job-artifacts-expired-api' into 'master'

Correct job artifacts API download for expired and locked files

See merge request gitlab-org/gitlab!53567
parents b4ce0ed1 4a12ee2b
---
title: Correct job artifacts API download for expired and locked files
merge_request: 53567
author: Fabio Huser
type: fixed
...@@ -90,7 +90,7 @@ module API ...@@ -90,7 +90,7 @@ module API
build = find_build!(params[:job_id]) build = find_build!(params[:job_id])
authorize_read_job_artifacts!(build) authorize_read_job_artifacts!(build)
not_found! unless build.artifacts? not_found! unless build.available_artifacts?
path = Gitlab::Ci::Build::Artifacts::Path path = Gitlab::Ci::Build::Artifacts::Path
.new(params[:artifact_path]) .new(params[:artifact_path])
......
...@@ -329,6 +329,17 @@ RSpec.describe API::Jobs do ...@@ -329,6 +329,17 @@ RSpec.describe API::Jobs do
.to include('Content-Type' => 'application/json', .to include('Content-Type' => 'application/json',
'Gitlab-Workhorse-Send-Data' => /artifacts-entry/) 'Gitlab-Workhorse-Send-Data' => /artifacts-entry/)
end end
context 'when artifacts are locked' do
it 'allows access to expired artifact' do
pipeline.artifacts_locked!
job.update!(artifacts_expire_at: Time.now - 7.days)
get_artifact_file(artifact)
expect(response).to have_gitlab_http_status(:ok)
end
end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment