diff --git a/src/current/netlify.toml b/src/current/netlify.toml index 7b8042f98be..805131a4f09 100644 --- a/src/current/netlify.toml +++ b/src/current/netlify.toml @@ -6,16 +6,27 @@ [build.environment] NODE_VERSION = "18.14.0" RUBY_VERSION = "3.2.1" + 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 +# Cache Plugin (keep caching for performance) +[[plugins]] + package = "netlify-plugin-cache" + [plugins.inputs] + paths = [ + ".jekyll-cache", + ".remote-includes-cache", + "node_modules/.cache", + "_data/cached" + ] + +# Retry functionality implemented in build script for robust production builds + [[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/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/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.4/cockroach-start.md b/src/current/v25.4/cockroach-start.md index b6f7d0fdbb3..e580c8c5ef0 100644 --- a/src/current/v25.4/cockroach-start.md +++ b/src/current/v25.4/cockroach-start.md @@ -6,7 +6,7 @@ key: start-a-node.html docs_area: reference.cli --- -This page explains the `cockroach start` [command]({% link {{ page.version.version }}/cockroach-commands.md %}), which you use to start a new multi-node cluster or add nodes to an existing cluster. +This page explains the `cockroach start` [command]({% link {{ page.version.version }}/cockroach-commands.md %), which you use to start a new multi-node cluster or add nodes to an existing cluster. {{site.data.alerts.callout_success}} If you need a simple single-node backend for app development, use [`cockroach start-single-node`]({% link {{ page.version.version }}/cockroach-start-single-node.md %}) instead, and follow the best practices for local testing described in [Test Your Application]({% link {{ page.version.version }}/local-testing.md %}).