From e32c2a98a2152d0700fc7a239645611f1e0ee0d6 Mon Sep 17 00:00:00 2001 From: Akshay Mankar Date: Thu, 10 Jul 2025 14:20:45 +0200 Subject: [PATCH] Makefile: Login to docker hub before setting up integration tests Only logs in if the credentials are provided. --- Makefile | 5 ++++- hack/bin/helm-oci-login.sh | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100755 hack/bin/helm-oci-login.sh diff --git a/Makefile b/Makefile index 38a53e00fdc..7e1ff3cf2ab 100644 --- a/Makefile +++ b/Makefile @@ -444,7 +444,7 @@ libzauth: kube-integration: kube-integration-setup kube-integration-test .PHONY: kube-integration-setup -kube-integration-setup: charts-integration +kube-integration-setup: charts-integration helm-oci-login export NAMESPACE=$(NAMESPACE); export HELM_PARALLELISM=$(HELM_PARALLELISM); ./hack/bin/integration-setup-federation.sh .PHONY: kube-integration-test @@ -468,6 +468,9 @@ kube-restart-%: kubectl delete pod -n $(NAMESPACE) -l app=$(*) kubectl delete pod -n $(NAMESPACE)-fed2 -l app=$(*) +helm-oci-login: + ./hack/bin/helm-oci-login.sh + .PHONY: latest-tag latest-tag: ./hack/bin/find-latest-docker-tag.sh diff --git a/hack/bin/helm-oci-login.sh b/hack/bin/helm-oci-login.sh new file mode 100755 index 00000000000..982d952e83b --- /dev/null +++ b/hack/bin/helm-oci-login.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +if [[ -z "${DOCKER_HUB_USERNAME+x}" ]]; then + echo "Not logging in to docker hub as there are no credentials provided." +else + helm registry login registry-1.docker.io --username "${DOCKER_HUB_USERNAME}" --password "${DOCKER_HUB_PASSWORD}" +fi