Skip to content

Commit

Permalink
set registry address in env var LOCAL_REGISTRY
Browse files Browse the repository at this point in the history
Signed-off-by: Thuan Vo <[email protected]>
  • Loading branch information
tthvo committed May 13, 2024
1 parent becd144 commit bb2ab6a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,11 @@ jobs:
exit 1
fi
local_reg=custom-registry:5001
docker pull busybox
docker tag busybox $local_reg/localbusybox
docker push $local_reg/localbusybox
docker tag busybox $LOCAL_REGISTRY/localbusybox
docker push $LOCAL_REGISTRY/localbusybox
kubectl create job test --image=$local_reg/localbusybox
kubectl create job test --image=$LOCAL_REGISTRY/localbusybox
kubectl wait --for=condition=complete --timeout=30s job/test
test-with-registry-and-delete-enabled:
Expand All @@ -229,13 +227,11 @@ jobs:
exit 1
fi
local_reg=custom-registry:5001
docker pull busybox
docker tag busybox $local_reg/localbusybox
docker tag busybox $LOCAL_REGISTRY/localbusybox
DIGEST=$(docker push $local_reg/localbusybox | grep -oE 'sha256:\w+')
DIGEST=$(docker push $LOCAL_REGISTRY/localbusybox | grep -oE 'sha256:\w+')
curl -X DELETE custom-registry:5001/v2/localbusybox/manifests/$DIGEST
[[ "$(curl -Ls custom-registry:5001/v2/localbusybox/tags/list | jq .tags)" == null ]]
curl -X DELETE $LOCAL_REGISTRY/v2/localbusybox/manifests/$DIGEST
[[ "$(curl -Ls $LOCAL_REGISTRY/v2/localbusybox/tags/list | jq .tags)" == null ]]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
registry_enable_delete: true
```
This will configure the cluster with an insecure local registry at `my-registry:5001` on both the host and within cluster.
This will configure the cluster with an insecure local registry at `my-registry:5001` on both the host and within cluster. Subsequent steps can refer to the registry address with the environment variable `LOCAL_REGISTRY` (i.e. `my-registry:5001`).

**Note**: If `config` option is used, you must manually configure the cluster with registry config dir enabled at `/etc/containerd/certs.d`. For example:

Expand Down
3 changes: 3 additions & 0 deletions registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ create_registry() {

# Local registry is available at $registry_name:$registry_port
echo "127.0.0.1 $registry_name" | sudo tee -a /etc/hosts

# Export environment variable for subsequent steps
echo "LOCAL_REGISTRY=$registry_name:$registry_port" >> "$GITHUB_ENV"
}

connect_registry() {
Expand Down

0 comments on commit bb2ab6a

Please sign in to comment.