Skip to content

Add dependency proxy to graphql

Steve Abrams requested to merge 322839-dependency-proxy-graphql into master

🐟 What does this MR do?

Adds dependency proxy types and fields to GraphQL. The dependency proxy is a group-level feature, so these are accessible through the group type.

🎞 Screenshots or Screencasts (strongly suggested)

Screen_Shot_2021-08-20_at_11.33.58_AM

🎣 How to setup and validate locally (strongly suggested)

  1. Set up the dependency proxy with GDK

  2. Create a group

  3. Pull a few images through the group using the dependency proxy

  4. Query the data:

     query {
       group(fullPath: "<your-group-full-path>") {
         id,
         dependencyProxyBlobCount
         dependencyProxyImageCount
         dependencyProxyTotalSize
         dependencyProxySetting {
           enabled
         }
         dependencyProxyManifests {
           nodes {
             fileName
             imageName
             size
             createdAt
             updatedAt
             digest
           }
         }    
         dependencyProxyBlobs {
           nodes {
             fileName
             size
             createdAt
             updatedAt
           }
         }
       }
     }

🐘 Database

Queries

Click to expand

When querying for dependencyProxyBlobCount

SELECT COUNT(*) FROM "dependency_proxy_blobs" WHERE "dependency_proxy_blobs"."group_id" = 9970

Explain plan 4.404 ms: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/6122/commands/20684


When querying for dependencyProxyImageCount

SELECT COUNT(*) FROM "dependency_proxy_manifests" WHERE "dependency_proxy_manifests"."group_id" = 9970

Explain plan 16.635 ms: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/6122/commands/20685


When querying for dependencyProxyTotalSize

SELECT SUM("dependency_proxy_manifests"."size") FROM "dependency_proxy_manifests" WHERE "dependency_proxy_manifests"."group_id" = 9970
SELECT SUM("dependency_proxy_blobs"."size") FROM "dependency_proxy_blobs" WHERE "dependency_proxy_blobs"."group_id" = 9970

When querying for dependencyProxySetting

SELECT "dependency_proxy_group_settings".* FROM "dependency_proxy_group_settings" WHERE "dependency_proxy_group_settings"."group_id" = 9970

Explain plan 4.107 ms: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/6122/commands/20688


When querying for dependencyProxyManifests

SELECT "dependency_proxy_manifests".* FROM "dependency_proxy_manifests" WHERE "dependency_proxy_manifests"."group_id" = 9970 ORDER BY "dependency_proxy_manifests"."id" DESC LIMIT 100

Explain plan: 1.677 ms: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/6122/commands/20722


When querying for dependencyProxyBlobs

SELECT "dependency_proxy_blobs".* FROM "dependency_proxy_blobs" WHERE "dependency_proxy_blobs"."group_id" = 9970 ORDER BY "dependency_proxy_blobs"."id" DESC LIMIT 100

Explain plan: 2.753ms: https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/6122/commands/20717

📐 Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #322839 (closed)

Edited by Steve Abrams

Merge request reports