You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zr...@apache.org on 2021/12/15 17:11:17 UTC
[camel-website] 01/03: chore: additional check that website is up
This is an automated email from the ASF dual-hosted git repository.
zregvart pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit 64bc5da0a8fa211aeb39eee49e98d38ec736994f
Author: Zoran Regvart <zo...@regvart.com>
AuthorDate: Wed Dec 15 14:31:50 2021 +0100
chore: additional check that website is up
When running the web server in a container for the redirect tests there
could be some network issues reaching it. This adds detection of that
situation and switches to using curl from inside of the web server
container.
This issue has occurred once on ASF Jenkins in build 622[1],
unfortunately without details allowing us to troubleshot this issue.
[1] https://ci-builds.apache.org/job/Camel/job/Camel.website/job/main/622/
---
tests/redirect.sh | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tests/redirect.sh b/tests/redirect.sh
index a05ebad..96752ea 100755
--- a/tests/redirect.sh
+++ b/tests/redirect.sh
@@ -84,6 +84,24 @@ if [ "$SERVE" == 1 ]; then
fi
fi
+# make sure we can reach the web site
+CURL_CMD=curl
+set +e
+$CURL_CMD -sS -k -o /dev/null --retry-all-errors --retry-delay 3 --retry 5 "$BASE_URL" || {
+ set -e
+ if [ -n "${CONTAINER_ID+x}" ]; then
+ echo Reverting to using curl from within the HTTP container
+ $CONTAINER_CMD exec "$CONTAINER_ID" apt-get update -y
+ $CONTAINER_CMD exec "$CONTAINER_ID" apt-get install -y curl
+ CURL_CMD="$CONTAINER_CMD exec $CONTAINER_ID curl"
+ BASE_URL=https://localhost
+ $CURL_CMD -sS -k -o /dev/null --retry-all-errors --retry-delay 3 --retry 5 "$BASE_URL"
+ else
+ exit 1
+ fi
+}
+set -e
+
TOTAL=0
SUCCESS=0
@@ -98,7 +116,7 @@ function test {
local output
set +e
- output=$(curl -k -w '%{http_code},%{redirect_url}\n' -o /dev/null -s "${url}")
+ output=$($CURL_CMD -k -w '%{http_code},%{redirect_url}' -o /dev/null -s "${url}")
set -e
TOTAL=$((TOTAL + 1))