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-2255 Refactor verify-compose action to wait for running|healthy state of containers #786

Merged
merged 3 commits into from
Oct 22, 2024
Merged
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
55 changes: 2 additions & 53 deletions .github/actions/dbp-charts/verify-compose/docker_compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ dump_all_compose_logs() {
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}"
dump_all_compose_logs
fi
}

cd "$COMPOSE_PATH" || {
echo "Error: docker compose dir not found"
exit 1
Expand All @@ -38,46 +24,9 @@ if [ "$COMPOSE_PULL" = "true" ]; then
$COMPOSE_BIN -f "${COMPOSE_FILE}" pull --quiet
fi
export COMPOSE_HTTP_TIMEOUT=120
$COMPOSE_BIN -f "${COMPOSE_FILE}" up -d --quiet-pull

WAIT_INTERVAL=1
COUNTER=0
TIMEOUT=300
t0=$(date +%s)
echo "Waiting for alfresco to start"
response=$(curl --write-out '%{http_code}' --output /dev/null --silent http://localhost:"${alf_port}"/alfresco/ || true)
until [[ "200" -eq "${response}" ]] || [[ "${COUNTER}" -eq "${TIMEOUT}" ]]; do
printf '.'
sleep "${WAIT_INTERVAL}"
COUNTER=$((COUNTER + WAIT_INTERVAL))
response=$(curl --write-out '%{http_code}' --output /dev/null --silent http://localhost:"${alf_port}"/alfresco/ || true)
done
wait_result Alfresco
$COMPOSE_BIN -f "${COMPOSE_FILE}" up -d --quiet-pull --wait

COUNTER=0
echo "Waiting for share to start"
response=$(curl --write-out '%{http_code}' --output /dev/null --silent http://localhost:8080/share/page || true)
until [[ "200" -eq "${response}" ]] || [[ "${COUNTER}" -eq "${TIMEOUT}" ]]; do
printf '.'
sleep "${WAIT_INTERVAL}"
COUNTER=$((COUNTER + WAIT_INTERVAL))
response=$(curl --write-out '%{http_code}' --output /dev/null --silent http://localhost:8080/share/page || true)
done
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

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
wait_result Solr
fi
echo "All services are up and running... starting postman tests"

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"
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v7.2.0
v8.0.0
Loading