Build Dependency Proxy group setting on query
🌳 Context
The Dependency Proxy is a group level feature, and it has a set of settings that exist at the group level as well in the DependencyProxy::GroupSetting
object. For scalability reasons, we only create records for these settings when groups use the feature, meaning, for every row in the groups
table, we do not have a row in the dependency_proxy_group_settings
table. Rows in the latter are only created when the Dependency Proxy is used or accessed.
Right now, there are certain situations where if you try to access the settings, instead of automatically creating them, we instead return NULL
, which is not desired. One such example is the GraphQL API, which is used by the Dependency Proxy UI page. If you query the dependency proxy settings for a group, you will receive NULL if the Dependency Proxy has never been used. However, the Dependency Proxy is enabled by default, so, you should receive a valid result.
🍃 What does this MR do and why?
This MR moves this "find_or_create" logic to the group model so that any part of the code that accesses group.dependency_proxy_group_setting
will always receive a result.
The DependencyProxyForContainersController
was already performing this logic, so we remove it from there and refactor it's tests appropriately.
📸 Screenshots or screen recordings
These are queries on groups where the Dependency Proxy has not yet been used, but the user has access to the group.
GraphQL query before | GraphQL query after |
---|---|
![]() |
![]() |
💻 How to set up and validate locally
- Create a group
- Using the graphql explorer http://gdk.test:3001/-/graphql-explorer, query the group dependency proxy settings:
{ group(fullPath: "<group_full_path>") { dependencyProxySetting { enabled } } }
- The response should not contain
NULL
📏 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.
Related to #342058 (closed)