Skip to content
Closed
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
2 changes: 1 addition & 1 deletion _layouts/redirect.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
{% assign absolute_target = page.target | absolute_url %}
{% assign absolute_target = page.target | replace: '$$LATEST_RELEASE$$', site.data.kroxylicious.latestRelease | absolute_url %}
<html lang="en">
<head>
<meta charset="utf-8">
Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ BUILD_COMMAND='eval "$(rbenv init -)" && cp -r /css/_sass/bootstrap /site/_sass/
RUN_ARGS+=(bash -c "${BUILD_COMMAND}")
echo "${RUN_ARGS[@]}"
${CONTAINER_ENGINE} run "${RUN_ARGS[@]}"
./test.sh
5 changes: 5 additions & 0 deletions get-started.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
layout: redirect
target: "/documentation/$$LATEST_RELEASE$$/html/proxy-quick-start/"
delay: 1
---
33 changes: 33 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Checks the output of build.sh (which is the production build deployed to pages)
set -euo pipefail

LATEST_RELEASE=$(grep "latestRelease:" _data/kroxylicious.yml | awk '{print $2}')

LATEST_RELEASE_QUICKSTART="_site/documentation/${LATEST_RELEASE}/html/proxy-quick-start/index.html"
PERMANENT_QUICKSTART_REDIRECT="_site/get-started.html"
EXPECTED_REDIRECT_STRING="<meta http-equiv=\"refresh\" content=\"1; url=https://kroxylicious.io/documentation/${LATEST_RELEASE}/html/proxy-quick-start/\">"

check_file_exists() {
local file_path="$1"
local file_description="$2"
if [ -f "${file_path}" ]; then
echo "SUCCESS: ${file_description} file found at ${file_path}"
else
echo "ERROR: ${file_description} file not found at ${file_path}" >&2
exit 1
fi
}

echo "Expect /get-started to HTML redirect to the latest quickstart"
check_file_exists "${LATEST_RELEASE_QUICKSTART}" "Latest release quickstart"
check_file_exists "${PERMANENT_QUICKSTART_REDIRECT}" "Permanent quickstart redirect"

if grep -qF "${EXPECTED_REDIRECT_STRING}" "${PERMANENT_QUICKSTART_REDIRECT}"; then
echo "SUCCESS: Expected redirect string found in ${PERMANENT_QUICKSTART_REDIRECT}"
else
echo "ERROR: Expected redirect string '${EXPECTED_REDIRECT_STRING}' not found in ${PERMANENT_QUICKSTART_REDIRECT}"
exit 1
fi
echo "All checks succeeded!"
exit 0