Skip to content

Generalize AgentAuthorizationsFinder for supporting various access keywords

Shinya Maeda requested to merge adjust-agent-authorization-config into master

What does this MR do and why?

This MR is preliminary work for Persist user_access Agent Authorizations (!116363 - closed), which resolves Persist GitLab agent's user access configuratio... (#389430 - closed) and Show shared agents in deployment projects (#395498 - closed) eventually. It introduces the following changes:

  • Currently, config column of agent_project/group_authorizations tables persists parameters of ci_access keyword e.g. enviornments. We'd like to persist user_access as well, to do so, this MR explicitly puts the parameters under ci_access keyword for avoiding conflicts. This is done in app/services/clusters/agents/refresh_authorization_service.rb
  • Since we change the structure of config column, we need to make sure that it doesn't break the existing functionalities that rely on the legacy structure. This MR refactors the AgentAuthorizationsFinder to maintain parity and avoid breaking changes.
  • It generalizes AgentAuthorizationsFinder for flexible filtering and moves logic of FilterAuthorizationsService to the finder for gathering all of the filtering logic.

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.

Edited by Shinya Maeda

Merge request reports