diff --git a/yarn-project/.yarnrc.yml b/yarn-project/.yarnrc.yml index 9772212c2e90..8aaa7608581e 100644 --- a/yarn-project/.yarnrc.yml +++ b/yarn-project/.yarnrc.yml @@ -7,3 +7,7 @@ logFilters: level: discard nodeLinker: node-modules + +# Do not allow 'yarn install' on CI to format package.json files, +# otherwise it will change their hash and bust the cache +immutablePatterns: ['**/package.json'] diff --git a/yarn-project/bootstrap.sh b/yarn-project/bootstrap.sh index 126216c2f64f..922a60c72778 100755 --- a/yarn-project/bootstrap.sh +++ b/yarn-project/bootstrap.sh @@ -93,8 +93,10 @@ function build { echo_header "yarn-project build" denoise "./bootstrap.sh clean-lite" if [ "${CI:-0}" = 1 ]; then - # If in CI mode, retry as bcrypto can sometimes fail mysteriously and we don't expect actual yarn install errors. - denoise "retry yarn install" + # If in CI mode, retry as bcrypto can sometimes fail mysteriously. + # We set immutable since we don't expect the yarn.lock to change. Note that we have also added all package.json + # files to yarn immutablePatterns, so if they are also changed, this step will fail. + denoise "retry yarn install --immutable" else denoise "yarn install" fi