diff --git a/.github/workflows/ci_tests.yaml b/.github/workflows/ci_tests.yaml index 1c956115b..5055b3cd1 100644 --- a/.github/workflows/ci_tests.yaml +++ b/.github/workflows/ci_tests.yaml @@ -72,7 +72,6 @@ jobs: - name: Create K8s KinD Cluster run: | - kind version make test-cluster - name: Build and Push Test Container Image to KIND node @@ -123,7 +122,6 @@ jobs: - name: Create K8s KinD Cluster run: | - kind version make test-cluster - name: Build and Push Test Container Image to KIND node diff --git a/scripts/kind-with-registry.sh b/scripts/kind-with-registry.sh index 91ea55d3c..497387dd6 100755 --- a/scripts/kind-with-registry.sh +++ b/scripts/kind-with-registry.sh @@ -5,11 +5,18 @@ set -o errexit KIND_CLUSTER_NAME="${KIND_CLUSTER_NAME:-kind}" KIND_IMG_TAG="${KIND_IMG_TAG:-}" -# create registry container unless it already exists +# create registry container unless it's already running reg_name='kind-registry' -reg_port='5000' -running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" 2>/dev/null || true)" +reg_port="${REGISTRY_PORT:-'5000'}" +echo "Checking for running ${reg_name} container..." +running="$(docker inspect -f '{{.State.Running}}' "${reg_name}" || true)" if [ "${running}" != 'true' ]; then + REG_CONTAINER_ID="$(docker inspect -f '{{.Id}}' "${reg_name}" || true)" + if [[ -n "${REG_CONTAINER_ID}" ]]; then + echo "Removing existing container:" + docker rm ${REG_CONTAINER_ID} + fi + echo "Starting new ${reg_name} container:" docker run \ -d --restart=always -p "${reg_port}:5000" --name "${reg_name}" \ registry:2