Refactor Agent Authorization
What does this MR do and why?
Currently, GitLab Rails doesn't have a way to authorize a job if it can access to an agent via ci_access
keyword. The actual authorization is currently happening in KAS side (Rails just provide agent authorization info but the data is consumed in KAS), however, we sometimes need to know it in Rails side as well.
The main purpose of this MR is to introduce Ci::Build#allowed_to_access_agent?
method. This will be used in the downstream MR. Besides, this MR does a bit of refactoring for DRY sake.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.