diff --git a/scripts/ci_test.sh b/scripts/ci_test.sh index f9029d5..5a63bc6 100755 --- a/scripts/ci_test.sh +++ b/scripts/ci_test.sh @@ -7,6 +7,14 @@ set -o pipefail SECRETS_BASE_PATH="${SECRETS_BASE_PATH:-/var/run/secrets}" JOB_NAME="assisted-chat-eval-test" +if [[ -n $ASSISTED_CHAT_TEST ]]; then + echo "The variable ASSISTED_CHAT_TEST was proided with the value ${ASSISTED_CHAT_TEST}, using it to create the IMAGE and TAG variables for the template" +else + IMAGE="quay.io/redhat-user-workloads/assisted-installer-tenant/assisted-chat-test-image-saas-main/assisted-chat-test-image-saas-main" + echo "The variable ASSISTED_CHAT_TEST was not provieded, downloading the latest image from ${IMAGE}" + ASSISTED_CHAT_TEST="${IMAGE}:latest" +fi + if ! oc get secret -n "$NAMESPACE" assisted-chat-ssl-ci &>/dev/null; then echo "Creating assisted-chat-ssl-ci secret in namespace $NAMESPACE" oc create secret generic -n "$NAMESPACE" assisted-chat-ssl-ci --from-file=client_id="${SECRETS_BASE_PATH}/sso-ci/client_id" \ @@ -39,21 +47,15 @@ while [ $ELAPSED -lt $TIMEOUT ]; do JOB_FAILED=$(oc get job "$JOB_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.failed}' 2>/dev/null) if [[ "$JOB_SUCCEEDED" -gt 0 ]]; then - echo "Pod ${POD_NAME} is successfully completed, exiting" - oc logs -n "$NAMESPACE" "$POD_NAME" + echo "The evaluation test were successful. The logs of the tests are stored in the directory artifacts/eval-test/gather-extra/artifacts/pods/ in the logs of the pod ${POD_NAME}." exit 0 fi if [[ "$JOB_FAILED" -gt 0 ]]; then echo "Pod ${POD_NAME} is Failed, exiting" - oc logs -n "$NAMESPACE" "$POD_NAME" - ASSISTED_CHAT_POD=$(oc get pods -n "$NAMESPACE" | tr -s ' ' | cut -d ' ' -f1 | grep -v assisted-chat-eval-test | grep assisted-chat) - echo "oc logs -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\"" - oc logs -n "$NAMESPACE" "$ASSISTED_CHAT_POD" + echo "The evaluation tests failed, you can see the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/." echo "oc events" oc events -n "$NAMESPACE" - echo "oc describe pod -n \"$NAMESPACE\" \"$ASSISTED_CHAT_POD\"" - oc describe pod -n "$NAMESPACE" "$ASSISTED_CHAT_POD" exit "$(oc get pod "$POD_NAME" -n "$NAMESPACE" -o=jsonpath='{.status.containerStatuses[0].lastState.terminated.exitCode}')" fi @@ -62,7 +64,6 @@ while [ $ELAPSED -lt $TIMEOUT ]; do ELAPSED=$((ELAPSED + 1)) done -oc logs -n "$NAMESPACE" "$POD_NAME" -echo "Timeout reached. Pod $POD_NAME did not become ready in time." +echo "Timeout reached. Pod $POD_NAME did not become ready in time. PLease check the logs of the pods under the directory artifacts/eval-test/gather-extra/artifacts/pods/." exit 1 diff --git a/scripts/deploy_template.sh b/scripts/deploy_template.sh index 90c466e..8de6b49 100755 --- a/scripts/deploy_template.sh +++ b/scripts/deploy_template.sh @@ -11,9 +11,15 @@ SECRETS_BASE_PATH="${SECRETS_BASE_PATH:-/var/run/secrets}" #$ASSISTED_CHAT_IMG is not in repo/image:tag format but rather in repo/@sha256: #The template needs the tag, and it references the image by : so splitting the variable by ":" works for now -echo "$ASSISTED_CHAT_IMG" -IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1) -TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2) +if [[ -n $ASSISTED_CHAT_IMG ]]; then + echo "The variable ASSISTED_CHAT_IMG was proided with the value ${ASSISTED_CHAT_IMG}, using it to create the IMAGE and TAG variables for the template" + IMAGE=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f1) + TAG=$(echo "$ASSISTED_CHAT_IMG" | cut -d ":" -f2) +else + IMAGE="quay.io/redhat-services-prod/assisted-installer-tenant/saas/assisted-chat" + echo "The variable ASSISTED_CHAT_IMG was not provieded, downloading the latest image from ${IMAGE}" + TAG="latest" +fi # What secrets have we got? ls -laR "$SECRETS_BASE_PATH" @@ -81,13 +87,7 @@ oc process \ oc apply -n "$NAMESPACE" -f - sleep 5 -if ! oc rollout status -n $NAMESPACE deployment/assisted-chat --timeout=300s; then - echo "Deploying assisted-chat failed" - ASSISTED_CHAT_POD=$(oc get pods -n "$NAMESPACE" | tr -s ' ' | cut -d ' ' -f1 | grep assisted-chat) - echo "The logs of the pod ${ASSISTED_CHAT_POD}" - oc logs -n $NAMESPACE "$ASSISTED_CHAT_POD" - echo "The events in the namespace '${NAMESPACE}'" - oc events -n $NAMESPACE - echo "oc describe pod ${ASSISTED_CHAT_POD}" - oc describe pod $ASSISTED_CHAT_POD +if ! oc rollout status -n $NAMESPACE deployment/assisted-chat --timeout=300s; then + echo "Deploying assisted-chat failed, the logs of the pods are in artifacts/eval-test/gather-extra/artifacts/pods/ directory." + exit 1 fi