Skip to content

Commit

Permalink
_scripts: do not use cache volumes on Netlify
Browse files Browse the repository at this point in the history
Fix up build.bash to set --nocachevolume on Netlify. Indeed fix up the
script to be easier to read, with sensible safe defaults (for Netlify),
and comments for any adjustments.

Signed-off-by: Paul Jolly <[email protected]>
Change-Id: Ibadf30047fba2833791690c4428438b5fd6134fe
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1177095
Reviewed-by: Jonathan Matthews <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
  • Loading branch information
myitcv committed Feb 20, 2024
1 parent a995ac7 commit a186509
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions _scripts/build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,44 @@ set -eux
# cd to the parent directory to that containing the script
cd "$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )/.."

skipcache=""
readonlycache="true"
# Defaults, appropriate for the sensitive Netlify environment
time=""
readonlycache="--readonlycache"
nocachevolume="--nocachevolume"
skipcache=""
minify="--minify"

if [ "${NETLIFY:-}" != "true" ]
then
# Local or CI - just not Netlify

# It's useful to see timings on steps
time="time -p"
readonlycache="false"
minify=""

# In CI or locally we want to write to cache files. But per below we only
# skip initially reading the cache in the case of CI. This is how we detect
# stale caches.
readonlycache=""

if [ "${CI:-}" == "true" ]
then
skipcache="--skipcache=true --nocachevolume"
# See comment above for readonlycache
skipcache="--skipcache"
else
# Locally we don't want to minify the results of Hugo to help make
# debugging easier
minify=""

# We do want to use cache volumes locally... and only locally.
nocachevolume=""
fi
fi

# Build playground
bash playground/_scripts/build.bash

# Run the preprocessor
bash _scripts/runPreprocessor.bash execute --readonlycache=$readonlycache $skipcache
bash _scripts/runPreprocessor.bash execute $readonlycache $nocachevolume $skipcache

# Main site
cd hugo
Expand Down

0 comments on commit a186509

Please sign in to comment.