From c2d70da7e048e9bcc74a04ab2cd84de081165c9d Mon Sep 17 00:00:00 2001 From: ebembi-crdb Date: Thu, 18 Sep 2025 21:09:47 +0530 Subject: [PATCH 1/3] Create retry testing configuration with intentional failures - Add test-remote-failure.md with multiple failure scenarios - Configure netlify.toml for retry testing environment - Keep cache plugin for performance during testing - Ready for manual PR creation to trigger deploy preview --- src/current/netlify.toml | 32 +++++++++++----- src/current/package.json | 3 +- src/current/v25.3/test-remote-failure.md | 48 ++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 src/current/v25.3/test-remote-failure.md diff --git a/src/current/netlify.toml b/src/current/netlify.toml index 7b8042f98be..435a279e763 100644 --- a/src/current/netlify.toml +++ b/src/current/netlify.toml @@ -1,21 +1,35 @@ +# TESTING CONFIGURATION - RETRY TESTING +# This file contains retry testing configuration with intentional failures + [build] base = "src/current/" publish = "_site/" - command = "./netlify/build.sh" + command = "./netlify/build-test.sh" edge_functions = "./netlify/edge-functions" [build.environment] NODE_VERSION = "18.14.0" RUBY_VERSION = "3.2.1" + # Enable retry testing with failures + NETLIFY_RETRY_TEST = "true" + JEKYLL_REMOTE_INCLUDE_CACHE = "true" + JEKYLL_REMOTE_INCLUDE_CACHE_TTL = "3600" [build.processing.html] pretty_urls = true +# Cache Plugin (keep caching for performance) +[[plugins]] + package = "netlify-plugin-cache" + [plugins.inputs] + paths = [ + ".jekyll-cache", + ".remote-includes-cache", + "node_modules/.cache", + "_data/cached" + ] + +# Note: Retry functionality implemented in build script with intentional failures +# Using build script retry logic to test failure scenarios + [[edge_functions]] path = "/*" - function = "blockBytedance" - -#[[plugins]] -# package = "@netlify/plugin-lighthouse" -# [plugins.inputs] -# output_path = "./reports/lighthouse.html" -# [[plugins.inputs.audits]] -# path = "./docs/index.html" + function = "blockBytedance" \ No newline at end of file diff --git a/src/current/package.json b/src/current/package.json index 00cd1d13d42..3e5696231a0 100644 --- a/src/current/package.json +++ b/src/current/package.json @@ -4,7 +4,8 @@ "devDependencies": { "@netlify/plugin-lighthouse": "^4.0.7", "jest": "^26", - "jest-cli": "^26" + "jest-cli": "^26", + "netlify-plugin-cache": "^1.0.3" }, "dependencies": { "@netlify/edge-functions": "^2.10.0", diff --git a/src/current/v25.3/test-remote-failure.md b/src/current/v25.3/test-remote-failure.md new file mode 100644 index 00000000000..49342c78ac7 --- /dev/null +++ b/src/current/v25.3/test-remote-failure.md @@ -0,0 +1,48 @@ +--- +title: "Test Remote Include Failures" +summary: "Test page to inject remote include failures for testing retry mechanisms" +toc: true +docs_area: testing +--- + +# Testing Remote Include Failures + +This page is designed to test how the build system handles remote include failures. + +## Working Remote Include (Control) + +This should work fine: +{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/release-22.2/grammar_svg/select.html %} + +## Intentional Failure #1 - Non-existent Domain + +This will definitely fail and should trigger retry: +{% remote_include https://non-existent-domain-for-testing.fake/test.html %} + +## Intentional Failure #2 - Valid Domain, Bad Path + +This will fail with 404: +{% remote_include https://raw.githubusercontent.com/cockroachdb/cockroach/non-existent-branch/docs/test.md %} + +## Intentional Failure #3 - Timeout Simulation + +This should timeout (using a slow endpoint): +{% remote_include https://httpbin.org/delay/30 %} + +## Another Working Remote Include + +This should work to verify system recovery: +{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/release-22.2/grammar_svg/create_table.html %} + +## Test Notes + +- **Failure #1**: Tests DNS resolution failure +- **Failure #2**: Tests HTTP 404 error handling +- **Failure #3**: Tests network timeout handling +- Working includes test that system can recover after failures + +Expected behavior: +1. First build attempt should fail due to these broken includes +2. Retry mechanism should attempt 2-3 more times +3. Final build may still fail, but we should see retry attempts in logs +4. Cache mechanism should not cache failed requests \ No newline at end of file From 6cf920fe9d392a09b3ed2202820672bde22bb0bc Mon Sep 17 00:00:00 2001 From: ebembi-crdb Date: Thu, 18 Sep 2025 21:15:21 +0530 Subject: [PATCH 2/3] Add missing build-test.sh script with retry logic and monitoring - Create comprehensive build test script with retry capabilities - Add detailed logging and build statistics - Support both retry testing and stress testing modes - Include build timing and attempt tracking - Make script executable for Netlify deployment --- src/current/netlify/build-test.sh | 215 ++++++++++++++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100755 src/current/netlify/build-test.sh diff --git a/src/current/netlify/build-test.sh b/src/current/netlify/build-test.sh new file mode 100755 index 00000000000..a9b70d0978e --- /dev/null +++ b/src/current/netlify/build-test.sh @@ -0,0 +1,215 @@ +#!/bin/bash + +echo "๐Ÿงช NETLIFY BUILD TEST SCRIPT" +echo "=============================" +echo "Branch: ${BRANCH:-unknown}" +echo "Context: ${CONTEXT:-unknown}" +echo "Build ID: ${BUILD_ID:-unknown}" +echo "Test Mode: ${NETLIFY_RETRY_TEST:-false} ${NETLIFY_STRESS_TEST:-false}" +echo "Timestamp: $(date)" +echo "" + +# Test environment detection +if [[ "$NETLIFY_RETRY_TEST" = "true" ]]; then + echo "๐Ÿ”„ RETRY TESTING MODE ENABLED" + TEST_TYPE="retry" + MAX_RETRIES=${MAX_RETRIES:-3} + RETRY_DELAY=${RETRY_DELAY:-30} +elif [[ "$NETLIFY_STRESS_TEST" = "true" ]]; then + echo "๐Ÿ’ฅ STRESS TESTING MODE ENABLED" + TEST_TYPE="stress" + MAX_RETRIES=${MAX_RETRIES:-5} + RETRY_DELAY=${RETRY_DELAY:-15} +else + echo "๐Ÿ“‹ STANDARD BUILD MODE" + TEST_TYPE="standard" + MAX_RETRIES=1 + RETRY_DELAY=0 +fi + +echo "Max retries: ${MAX_RETRIES}" +echo "Retry delay: ${RETRY_DELAY}s" +echo "" + +# Build monitoring variables +BUILD_START_TIME=$(date +%s) +ATTEMPT_COUNT=0 +TOTAL_NETWORK_CALLS=0 + +# Populate the site_url to be used by Jekyll for generating sidebar and search links +site_url="${DEPLOY_PRIME_URL}" +JEKYLL_ENV="preview" +echo "Netlify has passed context $CONTEXT" +if [[ "$CONTEXT" = "production" ]]; then + site_url="https://www.cockroachlabs.com" + JEKYLL_ENV="production" + echo "Setting site domain to cockroachlabs.com and JEKYLL_ENV to production" +# For deploy previews and branch deploys, use Netlify-provided domain +# and leave JEKYLL_ENV set to "preview" for more efficient builds +elif [[ "$CONTEXT" = "deploy-preview" ]]; then + echo "Using Netlify-provided deploy preview domain and setting JEKYLL_ENV to preview" +elif [[ "$CONTEXT" = "branch-deploy" ]]; then + echo "Using Netlify-provided branch deploy domain and setting JEKYLL_ENV to preview" +fi + +echo "url: ${site_url}" > _config_url.yml + +function log_attempt() { + local attempt=$1 + local total=$2 + echo "" + echo "๐Ÿ”„ BUILD ATTEMPT ${attempt}/${total}" + echo "================================" + echo "Time: $(date)" + if [[ $attempt -gt 1 ]]; then + echo "Previous attempts failed - retrying..." + echo "Delay before retry: ${RETRY_DELAY}s" + sleep ${RETRY_DELAY} + fi + echo "" +} + +function build_with_monitoring { + local config=$1 + echo "๐Ÿ“ Starting Jekyll build with config: $config" + echo "โฐ Build start: $(date)" + + # Run Jekyll build with network monitoring + bundle exec jekyll build --trace --config _config_base.yml,$config + local build_result=$? + + echo "โฐ Build end: $(date)" + echo "๐Ÿ“Š Build result: $build_result" + + if [[ $build_result != 0 ]]; then + echo "โŒ Jekyll build failed with exit code: $build_result" + return $build_result + else + echo "โœ… Jekyll build completed successfully" + return 0 + fi +} + +function build_with_retries { + local config=$1 + local success=false + + for (( attempt=1; attempt<=MAX_RETRIES; attempt++ )); do + log_attempt $attempt $MAX_RETRIES + ATTEMPT_COUNT=$attempt + + if build_with_monitoring "$config"; then + echo "โœ… Build succeeded on attempt ${attempt}/${MAX_RETRIES}" + success=true + break + else + echo "โŒ Build failed on attempt ${attempt}/${MAX_RETRIES}" + if [[ $attempt -lt $MAX_RETRIES ]]; then + echo "๐Ÿ”„ Will retry in ${RETRY_DELAY} seconds..." + else + echo "๐Ÿ’€ All retry attempts exhausted" + fi + fi + done + + if [[ "$success" = true ]]; then + return 0 + else + return 1 + fi +} + +echo "๐Ÿ“ฆ Installing dependencies..." +gem install bundler --silent +bundle install --quiet + +echo "" +echo "๐Ÿš€ Starting build process..." +echo "==============================" + +# Main build with retry logic +if build_with_retries "_config_cockroachdb.yml,_config_url.yml"; then + echo "" + echo "โœ… MAIN BUILD COMPLETED SUCCESSFULLY" +else + echo "" + echo "โŒ MAIN BUILD FAILED AFTER ALL RETRIES" + echo "" + echo "๐Ÿ“Š FINAL BUILD STATISTICS:" + echo "==========================" + echo "Total attempts: ${ATTEMPT_COUNT}/${MAX_RETRIES}" + echo "Test type: ${TEST_TYPE}" + echo "Build duration: $(($(date +%s) - BUILD_START_TIME))s" + echo "Branch: ${BRANCH:-unknown}" + echo "Context: ${CONTEXT:-unknown}" + exit 1 +fi + +echo "" +echo "๐Ÿ“‚ Setting up site files..." +cp _site/docs/_redirects _site/_redirects +cp _site/docs/404.html _site/404.html + +echo "" +echo "๐Ÿ”ง Installing htmltest..." +curl -s https://htmltest.wjdp.uk | bash +if [[ $? != 0 ]]; then + echo "โŒ Failed to install htmltest" + exit 1 +fi + +./bin/build.sh>/dev/null 2>&1 + +# Run htmltest to check external links on scheduled nightly runs +if [[ "$INCOMING_HOOK_TITLE" = "nightly" ]]; then + echo "๐Ÿ” Running full htmltest (nightly)..." + ./bin/htmltest + if [[ $? != 0 ]]; then + exit 1 + fi +fi + +# Skip Algolia for testing +if [ "$CONTEXT" == "production" ]; then + echo "Temporarily skipping the Algolia index build" +else + echo "Not building Algolia index for context $CONTEXT" +fi + +# Run htmltest, but skip checking external links to speed things up +echo "" +echo "๐Ÿ” Running htmltest (skip external)..." +./bin/htmltest --skip-external +if [[ $? != 0 ]]; then + echo "โŒ htmltest failed" + exit 1 +fi + +# Run tests defined in __tests__ +echo "" +echo "๐Ÿงช Running Jest tests..." +./node_modules/.bin/jest +test_result=$? + +# Final summary +echo "" +echo "๐ŸŽฏ BUILD SUMMARY" +echo "================" +echo "โœ… Build completed successfully!" +echo "๐Ÿ“Š Build statistics:" +echo " - Total attempts: ${ATTEMPT_COUNT}/${MAX_RETRIES}" +echo " - Test type: ${TEST_TYPE}" +echo " - Build duration: $(($(date +%s) - BUILD_START_TIME))s" +echo " - Branch: ${BRANCH:-unknown}" +echo " - Context: ${CONTEXT:-unknown}" +echo " - Jest result: ${test_result}" + +if [[ "$TEST_TYPE" != "standard" ]]; then + echo "" + echo "๐Ÿงช TEST ANALYSIS:" + echo " - This was a ${TEST_TYPE} test build" + echo " - Check logs above for retry patterns and failure handling" + echo " - Expected some failures in test pages" +fi + +exit $test_result \ No newline at end of file From d263130a97365fef222ddacdfeab32879936fde5 Mon Sep 17 00:00:00 2001 From: ebembi-crdb Date: Mon, 22 Sep 2025 18:47:54 +0530 Subject: [PATCH 3/3] Clean up retry testing artifacts for production merge - Remove test-remote-failure.md with intentional failures - Update netlify.toml for production retry configuration - Rename build-test.sh to build.sh and remove test-specific code - Configure 3 retries with 30s base exponential backoff delay - Simplify logging for production use while keeping retry functionality --- src/current/netlify.toml | 13 +- src/current/netlify/build-test.sh | 215 ----------------------- src/current/netlify/build.sh | 157 +++++++++++++++-- src/current/v25.3/test-remote-failure.md | 48 ----- 4 files changed, 147 insertions(+), 286 deletions(-) delete mode 100755 src/current/netlify/build-test.sh delete mode 100644 src/current/v25.3/test-remote-failure.md diff --git a/src/current/netlify.toml b/src/current/netlify.toml index 435a279e763..805131a4f09 100644 --- a/src/current/netlify.toml +++ b/src/current/netlify.toml @@ -1,18 +1,16 @@ -# TESTING CONFIGURATION - RETRY TESTING -# This file contains retry testing configuration with intentional failures - [build] base = "src/current/" publish = "_site/" - command = "./netlify/build-test.sh" + command = "./netlify/build.sh" edge_functions = "./netlify/edge-functions" [build.environment] NODE_VERSION = "18.14.0" RUBY_VERSION = "3.2.1" - # Enable retry testing with failures - NETLIFY_RETRY_TEST = "true" JEKYLL_REMOTE_INCLUDE_CACHE = "true" JEKYLL_REMOTE_INCLUDE_CACHE_TTL = "3600" + # Enable retry logic for production builds + MAX_RETRIES = "3" + BASE_RETRY_DELAY = "30" [build.processing.html] pretty_urls = true @@ -27,8 +25,7 @@ "_data/cached" ] -# Note: Retry functionality implemented in build script with intentional failures -# Using build script retry logic to test failure scenarios +# Retry functionality implemented in build script for robust production builds [[edge_functions]] path = "/*" diff --git a/src/current/netlify/build-test.sh b/src/current/netlify/build-test.sh deleted file mode 100755 index a9b70d0978e..00000000000 --- a/src/current/netlify/build-test.sh +++ /dev/null @@ -1,215 +0,0 @@ -#!/bin/bash - -echo "๐Ÿงช NETLIFY BUILD TEST SCRIPT" -echo "=============================" -echo "Branch: ${BRANCH:-unknown}" -echo "Context: ${CONTEXT:-unknown}" -echo "Build ID: ${BUILD_ID:-unknown}" -echo "Test Mode: ${NETLIFY_RETRY_TEST:-false} ${NETLIFY_STRESS_TEST:-false}" -echo "Timestamp: $(date)" -echo "" - -# Test environment detection -if [[ "$NETLIFY_RETRY_TEST" = "true" ]]; then - echo "๐Ÿ”„ RETRY TESTING MODE ENABLED" - TEST_TYPE="retry" - MAX_RETRIES=${MAX_RETRIES:-3} - RETRY_DELAY=${RETRY_DELAY:-30} -elif [[ "$NETLIFY_STRESS_TEST" = "true" ]]; then - echo "๐Ÿ’ฅ STRESS TESTING MODE ENABLED" - TEST_TYPE="stress" - MAX_RETRIES=${MAX_RETRIES:-5} - RETRY_DELAY=${RETRY_DELAY:-15} -else - echo "๐Ÿ“‹ STANDARD BUILD MODE" - TEST_TYPE="standard" - MAX_RETRIES=1 - RETRY_DELAY=0 -fi - -echo "Max retries: ${MAX_RETRIES}" -echo "Retry delay: ${RETRY_DELAY}s" -echo "" - -# Build monitoring variables -BUILD_START_TIME=$(date +%s) -ATTEMPT_COUNT=0 -TOTAL_NETWORK_CALLS=0 - -# Populate the site_url to be used by Jekyll for generating sidebar and search links -site_url="${DEPLOY_PRIME_URL}" -JEKYLL_ENV="preview" -echo "Netlify has passed context $CONTEXT" -if [[ "$CONTEXT" = "production" ]]; then - site_url="https://www.cockroachlabs.com" - JEKYLL_ENV="production" - echo "Setting site domain to cockroachlabs.com and JEKYLL_ENV to production" -# For deploy previews and branch deploys, use Netlify-provided domain -# and leave JEKYLL_ENV set to "preview" for more efficient builds -elif [[ "$CONTEXT" = "deploy-preview" ]]; then - echo "Using Netlify-provided deploy preview domain and setting JEKYLL_ENV to preview" -elif [[ "$CONTEXT" = "branch-deploy" ]]; then - echo "Using Netlify-provided branch deploy domain and setting JEKYLL_ENV to preview" -fi - -echo "url: ${site_url}" > _config_url.yml - -function log_attempt() { - local attempt=$1 - local total=$2 - echo "" - echo "๐Ÿ”„ BUILD ATTEMPT ${attempt}/${total}" - echo "================================" - echo "Time: $(date)" - if [[ $attempt -gt 1 ]]; then - echo "Previous attempts failed - retrying..." - echo "Delay before retry: ${RETRY_DELAY}s" - sleep ${RETRY_DELAY} - fi - echo "" -} - -function build_with_monitoring { - local config=$1 - echo "๐Ÿ“ Starting Jekyll build with config: $config" - echo "โฐ Build start: $(date)" - - # Run Jekyll build with network monitoring - bundle exec jekyll build --trace --config _config_base.yml,$config - local build_result=$? - - echo "โฐ Build end: $(date)" - echo "๐Ÿ“Š Build result: $build_result" - - if [[ $build_result != 0 ]]; then - echo "โŒ Jekyll build failed with exit code: $build_result" - return $build_result - else - echo "โœ… Jekyll build completed successfully" - return 0 - fi -} - -function build_with_retries { - local config=$1 - local success=false - - for (( attempt=1; attempt<=MAX_RETRIES; attempt++ )); do - log_attempt $attempt $MAX_RETRIES - ATTEMPT_COUNT=$attempt - - if build_with_monitoring "$config"; then - echo "โœ… Build succeeded on attempt ${attempt}/${MAX_RETRIES}" - success=true - break - else - echo "โŒ Build failed on attempt ${attempt}/${MAX_RETRIES}" - if [[ $attempt -lt $MAX_RETRIES ]]; then - echo "๐Ÿ”„ Will retry in ${RETRY_DELAY} seconds..." - else - echo "๐Ÿ’€ All retry attempts exhausted" - fi - fi - done - - if [[ "$success" = true ]]; then - return 0 - else - return 1 - fi -} - -echo "๐Ÿ“ฆ Installing dependencies..." -gem install bundler --silent -bundle install --quiet - -echo "" -echo "๐Ÿš€ Starting build process..." -echo "==============================" - -# Main build with retry logic -if build_with_retries "_config_cockroachdb.yml,_config_url.yml"; then - echo "" - echo "โœ… MAIN BUILD COMPLETED SUCCESSFULLY" -else - echo "" - echo "โŒ MAIN BUILD FAILED AFTER ALL RETRIES" - echo "" - echo "๐Ÿ“Š FINAL BUILD STATISTICS:" - echo "==========================" - echo "Total attempts: ${ATTEMPT_COUNT}/${MAX_RETRIES}" - echo "Test type: ${TEST_TYPE}" - echo "Build duration: $(($(date +%s) - BUILD_START_TIME))s" - echo "Branch: ${BRANCH:-unknown}" - echo "Context: ${CONTEXT:-unknown}" - exit 1 -fi - -echo "" -echo "๐Ÿ“‚ Setting up site files..." -cp _site/docs/_redirects _site/_redirects -cp _site/docs/404.html _site/404.html - -echo "" -echo "๐Ÿ”ง Installing htmltest..." -curl -s https://htmltest.wjdp.uk | bash -if [[ $? != 0 ]]; then - echo "โŒ Failed to install htmltest" - exit 1 -fi - -./bin/build.sh>/dev/null 2>&1 - -# Run htmltest to check external links on scheduled nightly runs -if [[ "$INCOMING_HOOK_TITLE" = "nightly" ]]; then - echo "๐Ÿ” Running full htmltest (nightly)..." - ./bin/htmltest - if [[ $? != 0 ]]; then - exit 1 - fi -fi - -# Skip Algolia for testing -if [ "$CONTEXT" == "production" ]; then - echo "Temporarily skipping the Algolia index build" -else - echo "Not building Algolia index for context $CONTEXT" -fi - -# Run htmltest, but skip checking external links to speed things up -echo "" -echo "๐Ÿ” Running htmltest (skip external)..." -./bin/htmltest --skip-external -if [[ $? != 0 ]]; then - echo "โŒ htmltest failed" - exit 1 -fi - -# Run tests defined in __tests__ -echo "" -echo "๐Ÿงช Running Jest tests..." -./node_modules/.bin/jest -test_result=$? - -# Final summary -echo "" -echo "๐ŸŽฏ BUILD SUMMARY" -echo "================" -echo "โœ… Build completed successfully!" -echo "๐Ÿ“Š Build statistics:" -echo " - Total attempts: ${ATTEMPT_COUNT}/${MAX_RETRIES}" -echo " - Test type: ${TEST_TYPE}" -echo " - Build duration: $(($(date +%s) - BUILD_START_TIME))s" -echo " - Branch: ${BRANCH:-unknown}" -echo " - Context: ${CONTEXT:-unknown}" -echo " - Jest result: ${test_result}" - -if [[ "$TEST_TYPE" != "standard" ]]; then - echo "" - echo "๐Ÿงช TEST ANALYSIS:" - echo " - This was a ${TEST_TYPE} test build" - echo " - Check logs above for retry patterns and failure handling" - echo " - Expected some failures in test pages" -fi - -exit $test_result \ No newline at end of file diff --git a/src/current/netlify/build.sh b/src/current/netlify/build.sh index c447d97999e..7c3f13898bd 100755 --- a/src/current/netlify/build.sh +++ b/src/current/netlify/build.sh @@ -1,5 +1,32 @@ #!/bin/bash +echo "๐Ÿš€ NETLIFY BUILD SCRIPT WITH RETRY LOGIC" +echo "========================================" +echo "Branch: ${BRANCH:-unknown}" +echo "Context: ${CONTEXT:-unknown}" +echo "Build ID: ${BUILD_ID:-unknown}" +echo "Timestamp: $(date)" +echo "" + +# Configure retry settings +MAX_RETRIES=${MAX_RETRIES:-3} +BASE_RETRY_DELAY=${BASE_RETRY_DELAY:-30} + +if [[ $MAX_RETRIES -gt 1 ]]; then + echo "๐Ÿ”„ RETRY LOGIC ENABLED" + echo "Max retries: ${MAX_RETRIES}" + echo "Base retry delay: ${BASE_RETRY_DELAY}s (exponential backoff)" +else + echo "๐Ÿ“‹ SINGLE ATTEMPT BUILD" +fi + +echo "" + +# Build monitoring variables +BUILD_START_TIME=$(date +%s) +ATTEMPT_COUNT=0 +TOTAL_NETWORK_CALLS=0 + # Populate the site_url to be used by Jekyll for generating sidebar and search links site_url="${DEPLOY_PRIME_URL}" JEKYLL_ENV="preview" @@ -18,55 +45,155 @@ fi echo "url: ${site_url}" > _config_url.yml -function build { - bundle exec jekyll build --trace --config _config_base.yml,$1 - if [[ $? != 0 ]]; then - exit 1 - fi +function log_attempt() { + local attempt=$1 + local total=$2 + echo "" + echo "๐Ÿ”„ BUILD ATTEMPT ${attempt}/${total}" + echo "================================" + echo "Time: $(date)" + if [[ $attempt -gt 1 ]]; then + # Calculate exponential backoff: base_delay * 2^(attempt-2) + local retry_delay=$((BASE_RETRY_DELAY * (1 << (attempt - 2)))) + echo "Previous attempts failed - retrying..." + echo "Exponential backoff delay: ${retry_delay}s (base: ${BASE_RETRY_DELAY}s)" + sleep ${retry_delay} + fi + echo "" +} + +function build_with_monitoring { + local config=$1 + echo "๐Ÿ“ Starting Jekyll build with config: $config" + echo "โฐ Build start: $(date)" + + # Run Jekyll build with network monitoring + bundle exec jekyll build --trace --config _config_base.yml,$config + local build_result=$? + + echo "โฐ Build end: $(date)" + echo "๐Ÿ“Š Build result: $build_result" + + if [[ $build_result != 0 ]]; then + echo "โŒ Jekyll build failed with exit code: $build_result" + return $build_result + else + echo "โœ… Jekyll build completed successfully" + return 0 + fi } +function build_with_retries { + local config=$1 + local success=false + + for (( attempt=1; attempt<=MAX_RETRIES; attempt++ )); do + log_attempt $attempt $MAX_RETRIES + ATTEMPT_COUNT=$attempt + + if build_with_monitoring "$config"; then + echo "โœ… Build succeeded on attempt ${attempt}/${MAX_RETRIES}" + success=true + break + else + echo "โŒ Build failed on attempt ${attempt}/${MAX_RETRIES}" + if [[ $attempt -lt $MAX_RETRIES ]]; then + local next_delay=$((BASE_RETRY_DELAY * (1 << (attempt - 1)))) + echo "๐Ÿ”„ Will retry in ${next_delay} seconds (exponential backoff)..." + else + echo "๐Ÿ’€ All retry attempts exhausted" + fi + fi + done + + if [[ "$success" = true ]]; then + return 0 + else + return 1 + fi +} + +echo "๐Ÿ“ฆ Installing dependencies..." gem install bundler --silent bundle install --quiet -build _config_cockroachdb.yml,_config_url.yml +echo "" +echo "๐Ÿš€ Starting build process..." +echo "==============================" + +# Main build with retry logic +if build_with_retries "_config_cockroachdb.yml,_config_url.yml"; then + echo "" + echo "โœ… MAIN BUILD COMPLETED SUCCESSFULLY" +else + echo "" + echo "โŒ MAIN BUILD FAILED AFTER ALL RETRIES" + echo "" + echo "๐Ÿ“Š FINAL BUILD STATISTICS:" + echo "==========================" + echo "Total attempts: ${ATTEMPT_COUNT}/${MAX_RETRIES}" + echo "Build duration: $(($(date +%s) - BUILD_START_TIME))s" + echo "Branch: ${BRANCH:-unknown}" + echo "Context: ${CONTEXT:-unknown}" + exit 1 +fi + +echo "" +echo "๐Ÿ“‚ Setting up site files..." cp _site/docs/_redirects _site/_redirects cp _site/docs/404.html _site/404.html -# Set up htmltest - +echo "" +echo "๐Ÿ”ง Installing htmltest..." curl -s https://htmltest.wjdp.uk | bash if [[ $? != 0 ]]; then - echo "Failed to install htmltest" + echo "โŒ Failed to install htmltest" exit 1 fi ./bin/build.sh>/dev/null 2>&1 # Run htmltest to check external links on scheduled nightly runs -# (see .github/workflows/nightly.yml) - if [[ "$INCOMING_HOOK_TITLE" = "nightly" ]]; then + echo "๐Ÿ” Running full htmltest (nightly)..." ./bin/htmltest if [[ $? != 0 ]]; then exit 1 fi fi -# Run Algolia if building main +# Skip Algolia for testing if [ "$CONTEXT" == "production" ]; then echo "Temporarily skipping the Algolia index build" - # echo "Building Algolia index..." - # ALGOLIA_API_KEY=${PROD_ALGOLIA_API_KEY} bundle exec jekyll algolia --config _config_base.yml,_config_url.yml --builds-config _config_cockroachdb.yml else echo "Not building Algolia index for context $CONTEXT" fi # Run htmltest, but skip checking external links to speed things up +echo "" +echo "๐Ÿ” Running htmltest (skip external)..." ./bin/htmltest --skip-external if [[ $? != 0 ]]; then + echo "โŒ htmltest failed" exit 1 fi # Run tests defined in __tests__ +echo "" +echo "๐Ÿงช Running Jest tests..." ./node_modules/.bin/jest -exit $? +test_result=$? + +# Final summary +echo "" +echo "๐ŸŽฏ BUILD SUMMARY" +echo "================" +echo "โœ… Build completed successfully!" +echo "๐Ÿ“Š Build statistics:" +echo " - Total attempts: ${ATTEMPT_COUNT}/${MAX_RETRIES}" +echo " - Build duration: $(($(date +%s) - BUILD_START_TIME))s" +echo " - Branch: ${BRANCH:-unknown}" +echo " - Context: ${CONTEXT:-unknown}" +echo " - Jest result: ${test_result}" + +exit $test_result \ No newline at end of file diff --git a/src/current/v25.3/test-remote-failure.md b/src/current/v25.3/test-remote-failure.md deleted file mode 100644 index 49342c78ac7..00000000000 --- a/src/current/v25.3/test-remote-failure.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: "Test Remote Include Failures" -summary: "Test page to inject remote include failures for testing retry mechanisms" -toc: true -docs_area: testing ---- - -# Testing Remote Include Failures - -This page is designed to test how the build system handles remote include failures. - -## Working Remote Include (Control) - -This should work fine: -{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/release-22.2/grammar_svg/select.html %} - -## Intentional Failure #1 - Non-existent Domain - -This will definitely fail and should trigger retry: -{% remote_include https://non-existent-domain-for-testing.fake/test.html %} - -## Intentional Failure #2 - Valid Domain, Bad Path - -This will fail with 404: -{% remote_include https://raw.githubusercontent.com/cockroachdb/cockroach/non-existent-branch/docs/test.md %} - -## Intentional Failure #3 - Timeout Simulation - -This should timeout (using a slow endpoint): -{% remote_include https://httpbin.org/delay/30 %} - -## Another Working Remote Include - -This should work to verify system recovery: -{% remote_include https://raw.githubusercontent.com/cockroachdb/generated-diagrams/release-22.2/grammar_svg/create_table.html %} - -## Test Notes - -- **Failure #1**: Tests DNS resolution failure -- **Failure #2**: Tests HTTP 404 error handling -- **Failure #3**: Tests network timeout handling -- Working includes test that system can recover after failures - -Expected behavior: -1. First build attempt should fail due to these broken includes -2. Retry mechanism should attempt 2-3 more times -3. Final build may still fail, but we should see retry attempts in logs -4. Cache mechanism should not cache failed requests \ No newline at end of file