Skip to content

Add dependency_proxy_manifests model

Steve Abrams requested to merge 241639-manifest-caching-models into master

🔍 What does this MR do?

Creates the dependency_proxy_manifests table, model, factory, and association with Group in preparation for implementing a cache for Docker Hub Container Registry manifest files. This table parallels the existing dependency_proxy_blobs (a different type of cached file from Docker Hub) table.

This is the foundation for allowing the Dependency Proxy feature to be used to help GitLab users mitigate the rate limiting that has recently been imposed on image pulls. See #241639 (comment 453870973) for additional notes about the subsequent MR that will implement the manifest caching.

🐘 Database

Up migration

== 20201125030847 CreateDependencyProxyManifests: migrating ===================
-- create_table(:dependency_proxy_manifests, {:if_not_exists=>true})
   -> 0.0114s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE dependency_proxy_manifests\nADD CONSTRAINT check_c579e3f586\nCHECK ( char_length(file_name) <= 255 )\nNOT VALID;\n")
   -> 0.0007s
-- current_schema()
   -> 0.0002s
-- execute("SET statement_timeout TO 0")
   -> 0.0002s
-- execute("ALTER TABLE dependency_proxy_manifests VALIDATE CONSTRAINT check_c579e3f586;")
   -> 0.0005s
-- execute("RESET ALL")
   -> 0.0002s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE dependency_proxy_manifests\nADD CONSTRAINT check_079b293a7b\nCHECK ( char_length(file) <= 255 )\nNOT VALID;\n")
   -> 0.0004s
-- current_schema()
   -> 0.0003s
-- execute("ALTER TABLE dependency_proxy_manifests VALIDATE CONSTRAINT check_079b293a7b;")
   -> 0.0006s
-- transaction_open?()
   -> 0.0000s
-- current_schema()
   -> 0.0002s
-- execute("ALTER TABLE dependency_proxy_manifests\nADD CONSTRAINT check_f5d9996bf1\nCHECK ( char_length(digest) <= 255 )\nNOT VALID;\n")
   -> 0.0004s
-- current_schema()
   -> 0.0003s
-- execute("ALTER TABLE dependency_proxy_manifests VALIDATE CONSTRAINT check_f5d9996bf1;")
   -> 0.0006s
== 20201125030847 CreateDependencyProxyManifests: migrated (0.0361s) ==========

Down migration

== 20201125030847 CreateDependencyProxyManifests: reverting ===================
-- drop_table(:dependency_proxy_manifests)
   -> 0.0130s
== 20201125030847 CreateDependencyProxyManifests: reverted (0.0131s) ==========

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] 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 #241639 (closed)

Edited by Steve Abrams

Merge request reports