Allow the usage of mirror registries/repositories in all/most places#984
Allow the usage of mirror registries/repositories in all/most places#984mozesl-nokia wants to merge 9 commits into
Conversation
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
There was a problem hiding this comment.
Pull request overview
This PR adds environment-variable-driven registry/mirror overrides for development builds, deployment scripts, kpt functions, and DB tests so contributors can work behind registry/proxy restrictions.
Changes:
- Adds
.env/environment support for GHCR, Docker Hub, and Maven mirror configuration. - Replaces hardcoded kpt function and Docker base image registries with configurable prefixes.
- Extends DB tests and dev setup scripts to consume mirror-related environment variables.
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
.env.template |
Documents mirror-related environment variables. |
Makefile |
Exports registry mirror defaults and adds dump-env. |
build/Dockerfile |
Makes Docker Hub base images configurable. |
build/Dockerfile.apiserver |
Adds usage TODO comment. |
build/Dockerfile.etcd |
Adds usage TODO comment. |
build/Makefile |
Passes Docker Hub mirror build args. |
controllers/Dockerfile |
Makes builder base image configurable. |
controllers/Makefile |
Passes Docker Hub mirror build args. |
func/Dockerfile |
Makes kpt function and base image registries configurable. |
func/Dockerfile-wrapperserver |
Makes base images configurable. |
func/Makefile |
Passes mirror-related build args. |
go.mod |
Adds godotenv dependency. |
go.sum |
Adds checksums for godotenv. |
make/deploy.mk |
Adjusts setup-dev-env help placement. |
pkg/cache/dbcache/dbcache_test.go |
Loads .env and applies Maven mirror to embedded Postgres. |
scripts/common.sh |
Loads .env and centralizes mirror defaults. |
scripts/create-deployment-blueprint.sh |
Uses configurable kpt function images and env-based Docker Hub mirror. |
scripts/create-deployment-config.sh |
Passes GHCR prefix to deployment blueprint generation. |
scripts/create-deployment-kpt.sh |
Uses configurable kpt function images. |
scripts/install-dev-gitea-setup.sh |
Sources common config and applies mirrors to Gitea setup. |
scripts/remove-controller-from-deployment-config.sh |
Uses configurable kpt function image prefix. |
scripts/remove-porch-server-from-deployment-config.sh |
Uses configurable kpt function image prefix. |
scripts/run-load-test.sh |
Uses configurable kpt function image prefix. |
test/Dockerfile |
Adds usage TODO comment. |
test/Makefile |
Adds usage TODO comment. |
Comments suppressed due to low confidence (1)
scripts/create-deployment-kpt.sh:136
- This is another
PORCH_GHCR_PREFIX_URLuse in aset -uscript that never initializes the variable. A direct run without the env var fails here before deployment customization can proceed.
--image "${PORCH_GHCR_PREFIX_URL}/starlark:v0.5.5" \
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 25 out of 26 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (4)
func/Makefile:55
- Same issue in the push target: the continued lines of this recipe need to be tab-indented as well, otherwise
makewill not parse this rule correctly.
docker buildx build --push --tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) \
--build-arg ALPINE_VERSION=$(ALPINE_VERSION) \
--build-arg GOLANG_ALPINE_VERSION=$(GOLANG_ALPINE_VERSION) \
$$(if [ -n "${DOCKERHUB_MIRROR}" ]; then echo "--build-arg DOCKERHUB_MIRROR=${DOCKERHUB_MIRROR}"; fi) \
$$(if [ -n "${PORCH_GHCR_PREFIX_URL}" ]; then echo "--build-arg PORCH_GHCR_PREFIX_URL=${PORCH_GHCR_PREFIX_URL}"; fi) \
-f ./Dockerfile "$(PORCHDIR)"
controllers/Makefile:33
- Same parsing issue in
push-image docker-push: the continuation lines must start with a tab to be part of the recipe.
docker buildx build --push --tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) \
--build-arg ALPINE_VERSION=$(ALPINE_VERSION) \
--build-arg GOLANG_BOOKWORM_VERSION=$(GOLANG_BOOKWORM_VERSION) \
$$(if [ -n "${DOCKERHUB_MIRROR}" ]; then echo "--build-arg DOCKERHUB_MIRROR=${DOCKERHUB_MIRROR}"; fi) \
-f Dockerfile ..
build/Makefile:35
- Same parsing issue in
push-image docker-push: continuation lines must begin with a tab, otherwise this target won't run.
docker buildx build --push --tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) \
--build-arg ALPINE_VERSION=$(ALPINE_VERSION) \
--build-arg GOLANG_BOOKWORM_VERSION=$(GOLANG_BOOKWORM_VERSION) \
$$(if [ -n "${DOCKERHUB_MIRROR}" ]; then echo "--build-arg DOCKERHUB_MIRROR=${DOCKERHUB_MIRROR}"; fi) \
-f ./Dockerfile "$(PORCHDIR)"
test/Makefile:33
- Same parsing issue in
push-image docker-push: the continueddocker buildx buildlines must be tab-indented to be part of the recipe.
docker buildx build --push --tag $(IMAGE_REPO)/$(IMAGE_NAME):$(IMAGE_TAG) \
--build-arg GOLANG_BOOKWORM_VERSION=$(GOLANG_BOOKWORM_VERSION) \
$$(if [ -n "${DOCKERHUB_MIRROR}" ]; then echo "--build-arg DOCKERHUB_MIRROR=${DOCKERHUB_MIRROR}"; fi) \
-f Dockerfile ..
| ARG ALPINE_VERSION=latest | ||
| ARG GOLANG_BOOKWORM_VERSION=latest | ||
| ARG DOCKERHUB_MIRROR=docker.io | ||
|
|
||
| FROM golang:1.25.7-bookworm AS builder | ||
| FROM ${DOCKERHUB_MIRROR}/golang:${GOLANG_BOOKWORM_VERSION} AS builder | ||
|
|
There was a problem hiding this comment.
@aravindtga was this kept intentionally pinned, or was this just an oversight before?
There was a problem hiding this comment.
@mozesl-nokia This is intentional. These values are not used by the make targets that build/push images. the actual values are defined in the root Makefile(passed by the respective Makefile/targets). This value will be used only when the Docker build is called without passing GOLANG_BOOKWORM_VERSION build argument.
|
Want to point this out from Copilot's comments: Do we want to rename the PORCH_GHCR_PREFIX_URL env var? |
Signed-off-by: Mózes László Máté <laszlo.mozes@nokia.com>
| export PORCH_GHCR_PREFIX_URL := $(patsubst %/,%,$(PORCH_GHCR_PREFIX_URL)) | ||
| export DOCKERHUB_MIRROR ?= | ||
| # remove '/' suffix | ||
| export DOCKERHUB_MIRROR := $(patsubst %/,%,$(DOCKERHUB_MIRROR)) |
There was a problem hiding this comment.
Should the build-images and push-images targets in make/build.mk be updated to propagate these values?
Title
Allow the usage of mirror registries/repositories in all/most places
Description
Related Issue(s)
(I thought we opened (and fixed) an issue for this, but I cannot find it.)
Type of Change
Checklist
Testing Instructions (Optional)
make setup-dev-envmake run-in-kind-db-cachereload-serverandreload-function-runner, but please try your favourite make targets and scripts too to make sure they all work.Additional Notes (Optional)
AI Disclosure
I used Cursor CLI on Auto to generate the script to import .env vars in common.sh