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 <[email protected]> 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
