From d6bf9a57482cf778001539c78798fc974d8dc853 Mon Sep 17 00:00:00 2001 From: Marcin Strankowski <74721865+mstrankowski@users.noreply.github.com> Date: Fri, 17 Nov 2023 10:59:28 +0100 Subject: [PATCH] Extend waiting script to work with mtls tests (#2321) --- .../tests/scripts/wait-for-alfresco-start.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/packaging/tests/scripts/wait-for-alfresco-start.sh b/packaging/tests/scripts/wait-for-alfresco-start.sh index 8b6940c3c50..54acab29637 100755 --- a/packaging/tests/scripts/wait-for-alfresco-start.sh +++ b/packaging/tests/scripts/wait-for-alfresco-start.sh @@ -9,13 +9,27 @@ then exit 1 fi +# If MTLS enabled configure keystore/truststore for curl command +if [[ $ALFRESCO_URL == https* ]]; then + KEYSTORE_TRUSTSTORE_PATH="${CI_WORKSPACE}/keystores/testClient" + KEYSTORE_PASSWORD="password" + + ADDITIONAL_MTLS_CONFIG="--key $KEYSTORE_TRUSTSTORE_PATH/client-key.pem --cert $KEYSTORE_TRUSTSTORE_PATH/client-cert.pem:$KEYSTORE_PASSWORD --cacert $KEYSTORE_TRUSTSTORE_PATH/testClient_truststore.pem" + if [[ ${HOSTNAME_VERIFICATION_DISABLED} == true ]]; then + ADDITIONAL_MTLS_CONFIG=$ADDITIONAL_MTLS_CONFIG" -k" + fi +else + ADDITIONAL_MTLS_CONFIG="" +fi + WAIT_INTERVAL=1 COUNTER=0 TIMEOUT=300 t0=$(date +%s) echo "Waiting for alfresco to start" -until $(curl --output /dev/null --silent --head --fail ${ALFRESCO_URL}) || [ "$COUNTER" -eq "$TIMEOUT" ]; do +echo curl --output /dev/null --silent --head --fail ${ADDITIONAL_MTLS_CONFIG} ${ALFRESCO_URL} +until $(curl --output /dev/null --silent --head --fail ${ADDITIONAL_MTLS_CONFIG} ${ALFRESCO_URL}) || [ "$COUNTER" -eq "$TIMEOUT" ]; do printf '.' sleep $WAIT_INTERVAL COUNTER=$(($COUNTER+$WAIT_INTERVAL))