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

OPSEXP-2801: refactor and bugfix of dbp-charts/verify-compose action #761

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
73 changes: 38 additions & 35 deletions .github/actions/dbp-charts/verify-compose/docker_compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ COMPOSE_PATH=$(dirname $COMPOSE_FILE_PATH)
COMPOSE_BIN="docker compose"
alf_port=8080

containers_dump_logs_on_error() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would use different name - is it only dumping logs when on error?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed not, it's only being called on errors in the script XD

echo "Dumping logs for all containers"
$COMPOSE_BIN -f "${COMPOSE_FILE}" logs --no-color
exit 1
}

wait_result() {
COMPONENT=$1
if (("${COUNTER}" < "${TIMEOUT}")); then
t1=$(date +%s)
delta=$(((t1 - t0) / 60))
echo "$COMPONENT Started in ${delta} minutes"
else
echo "Waited ${COUNTER} seconds"
echo "$COMPONENT could not start in time."
echo "The last response code was ${response}"
containers_dump_logs_on_error
fi
}

cd "$COMPOSE_PATH" || {
echo "Error: docker compose dir not found"
exit 1
Expand All @@ -13,7 +33,7 @@ docker info
$COMPOSE_BIN version
$COMPOSE_BIN -f "${COMPOSE_FILE}" config
echo "Starting Alfresco in docker compose"
$COMPOSE_BIN ps
$COMPOSE_BIN -f "${COMPOSE_FILE}" ps
if [ "$COMPOSE_PULL" = "true" ]; then
$COMPOSE_BIN -f "${COMPOSE_FILE}" pull --quiet
fi
Expand All @@ -32,16 +52,7 @@ until [[ "200" -eq "${response}" ]] || [[ "${COUNTER}" -eq "${TIMEOUT}" ]]; do
COUNTER=$((COUNTER + WAIT_INTERVAL))
response=$(curl --write-out '%{http_code}' --output /dev/null --silent http://localhost:"${alf_port}"/alfresco/ || true)
done
if (("${COUNTER}" < "${TIMEOUT}")); then
t1=$(date +%s)
delta=$(((t1 - t0) / 60))
echo "Alfresco Started in ${delta} minutes"
else
echo "Waited ${COUNTER} seconds"
echo "Alfresco could not start in time."
echo "The last response code from /alfresco/ was ${response}"
exit 1
fi
wait_result Alfresco

COUNTER=0
echo "Waiting for share to start"
Expand All @@ -52,33 +63,25 @@ until [[ "200" -eq "${response}" ]] || [[ "${COUNTER}" -eq "${TIMEOUT}" ]]; do
COUNTER=$((COUNTER + WAIT_INTERVAL))
response=$(curl --write-out '%{http_code}' --output /dev/null --silent http://localhost:8080/share/page || true)
done
if (("${COUNTER}" < "${TIMEOUT}")); then
t1=$(date +%s)
delta=$(((t1 - t0) / 60))
echo "Share Started in ${delta} minutes"
else
echo "Waited ${COUNTER} seconds"
echo "Share could not start in time."
echo "The last response code from /share/ was ${response}"
exit 1
fi
wait_result Share

if [ $($COMPOSE_BIN -f "${COMPOSE_FILE}" config | yq '.services.alfresco.environment.JAVA_OPTS | contains(" -Dindex.subsystem.name=solr6")') == "true" ]; then echo "Waiting more time for SOLR"
COUNTER=0
TIMEOUT=20

COUNTER=0
TIMEOUT=20
echo "Waiting more time for SOLR"
response=$(curl --write-out '%{http_code}' --user admin:admin --output /dev/null --silent http://localhost:"${alf_port}"/alfresco/s/api/solrstats || true)
until [[ "200" -eq "${response}" ]] || [[ "${COUNTER}" -eq "${TIMEOUT}" ]]; do
printf '.'
sleep "${WAIT_INTERVAL}"
COUNTER=$((COUNTER + WAIT_INTERVAL))
response=$(curl --write-out '%{http_code}' --user admin:admin --output /dev/null --silent http://localhost:"${alf_port}"/alfresco/s/api/solrstats || true)
done
until [[ "200" -eq "${response}" ]] || [[ "${COUNTER}" -eq "${TIMEOUT}" ]]; do
printf '.'
sleep "${WAIT_INTERVAL}"
COUNTER=$((COUNTER + WAIT_INTERVAL))
response=$(curl --write-out '%{http_code}' --user admin:admin --output /dev/null --silent http://localhost:"${alf_port}"/alfresco/s/api/solrstats || true)
done
wait_result Solr
fi

cd ..
docker run -a STDOUT --volume "${PWD}"/test/postman/docker-compose:/etc/newman --network host postman/newman:5.3 run "acs-test-docker-compose-collection.json" --global-var "protocol=http" --global-var "url=localhost:8080"

retVal=$?
if [ "${retVal}" -ne 0 ]; then
# show logs
$COMPOSE_BIN logs --no-color
exit 1
fi

[ "${retVal}" -eq 0 ] && echo "Postman tests were successful" || containers_dump_logs_on_error
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v7.1.0
v7.1.1
Loading