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 10:57:21 UTC

[camel-website] branch pr/redirect-test-robustness created (now 0d483cb)

This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a change to branch pr/redirect-test-robustness
in repository https://gitbox.apache.org/repos/asf/camel-website.git.


      at 0d483cb  chore: fetch .htaccess from git

This branch includes the following new commits:

     new 652db2f  chore: additional check that website is up
     new 0d483cb  chore: fetch .htaccess from git

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[camel-website] 02/02: chore: fetch .htaccess from git

Posted by zr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch pr/redirect-test-robustness
in repository https://gitbox.apache.org/repos/asf/camel-website.git

commit 0d483cb1b86ad0f695d8055c17ae9fdb4bb16648
Author: Zoran Regvart <zo...@regvart.com>
AuthorDate: Wed Dec 15 11:56:31 2021 +0100

    chore: fetch .htaccess from git
    
    If the website wasn't built we can still run the redirect checks by
    loading the live `.htaccess` file from the `asf-site` branch in git.
    This way we can run the redirect checks independent of the build if we
    need to.
---
 tests/redirect.sh | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/tests/redirect.sh b/tests/redirect.sh
index 7ccb05f..9ee0d4d 100755
--- a/tests/redirect.sh
+++ b/tests/redirect.sh
@@ -130,12 +130,18 @@ function test {
   fi
 }
 
+HTACCESS_FILE="$GIT_ROOT/documentation/.htaccess"
+if [ ! -f "$HTACCESS_FILE" ]; then
+  echo "No $HTACCESS_FILE found, using last published version. If you have made changes to the Antora playbook make sure to build the site first to test those."
+  $CURL_CMD -s -o "$HTACCESS_FILE" 'https://gitbox.apache.org/repos/asf?p=camel-website.git;a=blob_plain;f=.htaccess;hb=refs/heads/asf-site'
+fi
+
 # determine current _latest_ versions
-COMPONENTS_VERSION="$(grep 'components/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_K_VERSION="$(grep 'camel-k/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_KAFKA_CONNECTOR_VERSION="$(grep 'camel-kafka-connector/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_QUARKUS_VERSION="$(grep 'camel-quarkus/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
-CAMEL_KAMELETS_VERSION="$(grep 'camel-kamelets/latest' "$GIT_ROOT/documentation/.htaccess" | grep -Z -o '[^/]*$')"
+COMPONENTS_VERSION="$(grep '^Redirect 302 /components/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_K_VERSION="$(grep '^Redirect 302 /camel-k/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_KAFKA_CONNECTOR_VERSION="$(grep '^Redirect 302 /camel-kafka-connector/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_QUARKUS_VERSION="$(grep '^Redirect 302 /camel-quarkus/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
+CAMEL_KAMELETS_VERSION="$(grep '^Redirect 302 /camel-kamelets/latest' "$HTACCESS_FILE" | grep -Z -o '[^/]*$')"
 
 #
 # TESTS

[camel-website] 01/02: chore: additional check that website is up

Posted by zr...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zregvart pushed a commit to branch pr/redirect-test-robustness
in repository https://gitbox.apache.org/repos/asf/camel-website.git

commit 652db2f6daf6c4260f4b8a1812d105166d2f8a48
Author: Zoran Regvart <zo...@regvart.com>
AuthorDate: Wed Dec 15 11:55:28 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..7ccb05f 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 -k --no-progress-meter -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 -k --no-progress-meter -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}\n' -o /dev/null -s "${url}")
   set -e
   TOTAL=$((TOTAL + 1))