Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added validation to registry script #1508

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ local-registry:
./tools/deploy-local-registry.sh

local-docker-image:
DOCKER_BUILDKIT=1 docker build -t localhost:5000/wego-app:latest . --build-arg FLUX_VERSION=$(FLUX_VERSION)
docker push localhost:5000/wego-app:latest
DOCKER_BUILDKIT=1 docker build -t localhost:5001/wego-app:latest . --build-arg FLUX_VERSION=$(FLUX_VERSION)
docker push localhost:5001/wego-app:latest

test: dependencies cmd/gitops-server/cmd/dist/index.html
go test -v ./core/...
Expand Down Expand Up @@ -77,7 +77,7 @@ endif
gitops: bin/gitops ## Build the Gitops CLI, accepts a 'DEBUG' flag
gitops-server: cmd/gitops-server/cmd/dist/index.html bin/gitops-server ## Build the Gitops UI server, accepts a 'DEBUG' flag

DOCKER_REGISTRY?=localhost:5000
DOCKER_REGISTRY?=localhost:5001

_docker:
DOCKER_BUILDKIT=1 docker build $(DOCKERARGS)\
Expand Down
2 changes: 1 addition & 1 deletion Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local_resource(
)

docker_build_with_restart(
'localhost:5000/weaveworks/wego-app',
'localhost:5001/weaveworks/wego-app',
'.',
only=[
'./bin',
Expand Down
4 changes: 2 additions & 2 deletions test/acceptance/test/scripts/kind-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fi
kind_version=$(kind version)
kind_network='kind'
reg_name='kind-registry'
reg_port='5000'
reg_port='5001'
case "${kind_version}" in
"kind v0.7."* | "kind v0.6."* | "kind v0.5."*)
kind_network='bridge'
Expand Down Expand Up @@ -81,4 +81,4 @@ if [ "${kind_network}" != "bridge" ]; then
if [ "${needs_connect}" = "true" ]; then
docker network connect "${kind_network}" "${reg_name}" || true
fi
fi
fi
4 changes: 2 additions & 2 deletions tools/deploy-local-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
set -o errexit

reg_name='kind-registry'
reg_port='5000'
reg_port='5001'

# create registry container unless it already exists
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
if [ "${running}" != 'true' ]; then
docker run \
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
registry:2
echo "registry deployed"
else
Expand Down
12 changes: 10 additions & 2 deletions tools/kind-with-registry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fi
kind_version=$(kind version)
kind_network='kind'
reg_name='kind-registry'
reg_port='5000'
reg_port='5001'
case "${kind_version}" in
"kind v0.7."* | "kind v0.6."* | "kind v0.5."*)
kind_network='bridge'
Expand All @@ -41,8 +41,16 @@ esac
running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)"
if [ "${running}" != 'true' ]; then
docker run \
-d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \
-d --restart=always -p "127.0.0.1:${reg_port}:5000" --name "${reg_name}" \
registry:2
else
# Validate the ports used by the running register are the ones we need.
right_mapping_ports="5000/tcp -> 127.0.0.1:${reg_port}"
registry_port=$(docker port ${reg_name})
if [ "${registry_port}" != "${right_mapping_ports}" ]; then
echo "It seems the current registry is running on different port configuration than expected:\n\n Current => ($registry_port) \n Expected ($right_mapping_ports). \n\nTry deleting registry manually using 'docker rm -f $reg_name' "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Nice

exit 1
fi
fi

reg_host="${reg_name}"
Expand Down
2 changes: 1 addition & 1 deletion tools/wego-app-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
serviceAccountName: wego-app-service-account
containers:
- name: wego-app
image: localhost:5000/weaveworks/wego-app:latest
image: localhost:5001/weaveworks/wego-app:latest
args: ["-l", "--helm-repo-namespace", "wego-system"]
ports:
- containerPort: 9001
Expand Down