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

CSPL-3041 - Fix run-tests.sh to pull enterprise image appropriately #1405

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ patches:
- name: WATCH_NAMESPACE
value: WATCH_NAMESPACE_VALUE
- name: RELATED_IMAGE_SPLUNK_ENTERPRISE
value: docker.io/splunk/splunk:9.3.0
value: SPLUNK_ENTERPRISE_IMAGE
- name: OPERATOR_NAME
value: splunk-operator
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
fieldPath: metadata.name
32 changes: 22 additions & 10 deletions test/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,30 @@ 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
echo "Docker images"
docker images
Expand Down
Loading