feat: allow namespace override per image (#4725)#4762
feat: allow namespace override per image (#4725)#4762ffabss wants to merge 1 commit intosupabase:developfrom
Conversation
|
The env var you are looking for is append this before supabase start and it will pull images from dockerhub |
|
The issue is not that I can’t set the registry. The issue is that the method I changed explicitly checks for This behavior is inherently necessary because Supabase does not re-publish all images under the For the
So if someone is using a custom pull-through cache (still using What my changes addMy changes introduce the possibility to override the namespace per image, so users can configure the correct namespace for cases like GitLab Dependency Proxy. For example, Kong can be fixed by setting: ExampleThe method
With the new namespace override, users can ensure the method returns valid image URLs even when images are not available under |
Pull Request Test Coverage Report for Build 22073003576Details
💛 - Coveralls |
Could you let me know which registry are you using? We have kong published under supabase namespace for GHCR and ECR. These are the only ones we support officially right now. We are only making an exception for |
|
Im using the GitLab Dependency Proxy, which acts as a pull-through cache for The only real workaround would be to set up and maintain a separate pull-through cache that targets a different upstream registry (e.g. GHCR or AWS ECR). However, that adds operational overhead (infrastructure + configuration + ongoing maintenance). Images required for running all services locallyI checked which images are needed to run all services locally and found the following list:
These are the configured image names the CLI uses. Why the current behavior breaks with GitLab Dependency ProxyThe old logic for constructing the image URL effectively enforced the namespace Proposed solutionWith the proposed code changes, the following environment variables can be used to ensure images are pulled from the correct namespaces:
Additionally, the following would be used to direct Supabase to use the GitLab Dependency Proxy: This will set the registry to something like: See: https://docs.gitlab.com/user/packages/dependency_proxy/#authenticate-within-cicd |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Cache: Disabled due to Reviews > Disable Cache setting Disabled knowledge base sources:
📒 Files selected for processing (2)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request modifies the image reference handling in the Docker utility module. The Sequence Diagram(s)sequenceDiagram
participant Caller as Caller
participant Func as GetRegistryImageUrl
participant Config as Viper/Config
participant Result as Result
Caller->>Func: Call GetRegistryImageUrl(imageRef)
Func->>Func: Parse imageRef (registry?/namespace/image:tag)
alt invalid format
Func->>Result: Return original imageRef
else valid format
Func->>Config: Read INTERNAL_IMAGE_REGISTRY
Func->>Config: Read INTERNAL_IMAGE_NAMESPACE_<IMAGE> (override)
alt override present
Func->>Func: Apply override namespace
else no override
alt registry == docker.io
Func->>Func: Preserve provided namespace (e.g., library)
else
Func->>Func: Use default namespace "supabase"
end
end
Func->>Result: Build registry/namespace/image:tag and return
end
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What kind of change does this PR introduce?
Feature
What is the current behavior?
There is currently no support for overriding the namespace used when resolving container image references.
This makes it impossible to pull certain images (e.g.
kong) via the GitLab CI Dependency Proxy, which only supports images fromdocker.io.Related issue: #4725
What is the new behavior?
This PR introduces support for per-image namespace configuration via environment variables such as
SUPABASE_INTERNAL_IMAGE_NAMESPACE_KONG=library.With this change, users can explicitly control the resolved image namespace, enabling images like
kongto be pulled through the GitLab CI Dependency Proxy.Additional context
The image resolution logic was updated to apply the configured namespace when constructing the full image reference, and tests were added to cover the new behavior.