Skip to content

Commit 8703358

Browse files
committed
fix: local registry on a custom port
Signed-off-by: Niccolò Fei <niccolo.fei@enterprisedb.com>
1 parent 9949059 commit 8703358

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

BUILD.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,11 @@ registry (available at `localhost:5000`).
167167
task e2e:setup-env
168168
```
169169

170+
> [!INFO]
171+
> You can customize the local registry's port using the `REGISTRY_HOST_PORT` variable.
172+
> If you setup the environment with a custom `REGISTRY_HOST_PORT`, take care to include
173+
> this variable when running tasks that interact with the local registry.
174+
170175
### Get access to the cluster
171176

172177
To interact with the cluster via `kubectl` from your local terminal:

Taskfile.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ vars:
1111
E2E_NETWORK: pg-extensions-e2e
1212
DAGGER_ENGINE_NAME: dagger-engine-pg-extensions
1313
REGISTRY_NAME: registry.pg-extensions
14+
REGISTRY_HOST_IP: localhost
1415
REGISTRY_HOST_PORT: 5000
16+
REGISTRY_INTERNAL_PORT: 5000
1517
# renovate: datasource=git-refs depName=kind lookupName=https://github.com/aweris/daggerverse currentValue=main
1618
DAGGER_KIND_SHA: dadbc09a1e0790ccbf1d88f796308b26a12f0488
1719
# renovate: datasource=docker depName=kindest/node versioning=docker
@@ -72,6 +74,8 @@ tasks:
7274
- prereqs
7375
prefix: 'bake-{{.TARGET}}'
7476
silent: true
77+
env:
78+
registry: '{{ .REGISTRY_HOST_IP }}:{{ .REGISTRY_HOST_PORT }}'
7579
vars:
7680
PUSH: '{{.PUSH | default "false"}}'
7781
DRY_RUN: '{{.DRY_RUN | default "false"}}'
@@ -181,7 +185,7 @@ tasks:
181185
REGISTRY_VERSION: 3.0.0@sha256:6c5666b861f3505b116bb9aa9b25175e71210414bd010d92035ff64018f9457e
182186
cmds:
183187
- >
184-
docker run -d --name {{ .REGISTRY_NAME }} --rm -p {{ .REGISTRY_HOST_PORT }}:5000
188+
docker run -d --name {{ .REGISTRY_NAME }} --rm -p {{ .REGISTRY_HOST_PORT }}:{{ .REGISTRY_INTERNAL_PORT }}
185189
--network {{ .E2E_NETWORK }} registry:{{ .REGISTRY_VERSION }}
186190
status:
187191
- test "$(docker inspect -f {{`'{{json .State.Running}}'`}} {{ .REGISTRY_NAME }})" == "true"
@@ -210,7 +214,7 @@ tasks:
210214
internal: true
211215
run: once
212216
vars:
213-
REGISTRY_DIR: /etc/containerd/certs.d/{{ .REGISTRY_NAME }}:{{ .REGISTRY_HOST_PORT }}
217+
REGISTRY_DIR: /etc/containerd/certs.d/{{ .REGISTRY_NAME }}:{{ .REGISTRY_INTERNAL_PORT }}
214218
DOCKER_SOCKET:
215219
sh: docker context inspect -f {{`'{{json .Endpoints.docker.Host}}'`}} $(docker context show)
216220
env:
@@ -224,7 +228,7 @@ tasks:
224228
- docker exec "{{ .KIND_CLUSTER_NAME }}-control-plane" mkdir -p "{{ .REGISTRY_DIR }}"
225229
- |
226230
cat <<EOF | docker exec -i "{{ .KIND_CLUSTER_NAME }}-control-plane" cp /dev/stdin "{{ .REGISTRY_DIR }}/hosts.toml"
227-
[host."http://{{ .REGISTRY_NAME }}:5000"]
231+
[host."http://{{ .REGISTRY_NAME }}:{{ .REGISTRY_INTERNAL_PORT }}"]
228232
EOF
229233
status:
230234
- >
@@ -327,7 +331,7 @@ tasks:
327331
EXTENSION_IMAGE:
328332
# We need to replace localhost with the registry container name as it is how
329333
# the registry is reachable from within the Docker network.
330-
sh: sed -E 's/^localhost/{{ .REGISTRY_NAME }}/;t' <<< "{{ .EXTENSION_IMAGE }}"
334+
sh: sed -E 's/^{{ .REGISTRY_HOST_IP }}:{{ .REGISTRY_HOST_PORT }}/{{ .REGISTRY_NAME }}:{{ .REGISTRY_INTERNAL_PORT }}/;t' <<< "{{ .EXTENSION_IMAGE }}"
331335
requires:
332336
vars:
333337
- name: TARGET

0 commit comments

Comments
 (0)