From 7f9b7158f402f299e20219d8726cc29f78412e49 Mon Sep 17 00:00:00 2001 From: Arjun Kondur Date: Mon, 9 Dec 2024 16:15:14 -0600 Subject: [PATCH] Update 2.7.0 branch for gitlab testig needs. --- config/default/kustomization.yaml | 2 +- test/run-tests.sh | 31 +++++++++++++++++++++---------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 3c2396ba9..fa36d8a21 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -124,7 +124,7 @@ patches: - name: WATCH_NAMESPACE value: WATCH_NAMESPACE_VALUE - name: RELATED_IMAGE_SPLUNK_ENTERPRISE - value: docker.io/splunk/splunk:9.3.2 + value: SPLUNK_ENTERPRISE_IMAGE - name: OPERATOR_NAME value: splunk-operator - name: POD_NAME diff --git a/test/run-tests.sh b/test/run-tests.sh index e72757603..f563cae55 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -38,16 +38,27 @@ if [ -n "${PRIVATE_REGISTRY}" ]; then fi # Always attempt to pull splunk enterprise image - docker pull ${SPLUNK_ENTERPRISE_IMAGE} - if [ $? -ne 0 ]; then - echo "Unable to pull ${SPLUNK_ENTERPRISE_IMAGE}. Exiting..." - exit 1 - fi - docker tag ${SPLUNK_ENTERPRISE_IMAGE} ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE} - docker push ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE} - if [ $? -ne 0 ]; then - echo "Unable to push ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE}. Exiting..." - exit 1 + echo "check if image exists, docker manifest inspect $PRIVATE_SPLUNK_ENTERPRISE_IMAGE" + if docker manifest inspect "$PRIVATE_SPLUNK_ENTERPRISE_IMAGE" > /dev/null 2>&1; then + echo "Image $PRIVATE_SPLUNK_ENTERPRISE_IMAGE exists on the remote repository." + docker pull ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE} + if [ $? -ne 0 ]; then + echo "Unable to pull ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE}. Exiting..." + exit 1 + fi + else + echo "Image $PRIVATE_SPLUNK_ENTERPRISE_IMAGE does not exist on the remote repository." + docker pull ${SPLUNK_ENTERPRISE_IMAGE} + if [ $? -ne 0 ]; then + echo "Unable to pull ${SPLUNK_ENTERPRISE_IMAGE}. Exiting..." + exit 1 + fi + docker tag ${SPLUNK_ENTERPRISE_IMAGE} ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE} + docker push ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE} + if [ $? -ne 0 ]; then + echo "Unable to push ${PRIVATE_SPLUNK_ENTERPRISE_IMAGE}. Exiting..." + exit 1 + fi fi # Output