Add a redirect status as a success
Related: #549513 (closed)
What does this MR do and why?
Job authentication logs are not being populated when job artifacts being requested using CI_JOB_TOKEN
This MR fixes a bug Job authentication logs not populating for the job artifacts requests.
The job artifacts API returns a redirect to URL CDN/storage, but in middleware this is not treated as a success:
def call(env)
response = @app.call(env)
# We only log authorizations leading to successful requests.
Ci::JobToken::Authorization.log_captures_async if success?(response[0])
response
end
private
def success?(status)
(200..299).cover?(status)
end
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
Steps to reproduce in the issue - #549513 (closed) on Gitlab.com
It can't be reproduced on the local GDK setup.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Dmytro Biryukov