From 252b2a63c5ec1e43e121c6205bbbce1d86c832e4 Mon Sep 17 00:00:00 2001 From: Nicola Corti Date: Thu, 6 Jan 2022 10:44:36 -0800 Subject: [PATCH] Updating Yarn Cache path to fix broken CI (#32834) Summary: The CI is currently failing with: ``` Error extracting tarball /tmp/cache1419328940 : tar: root/.cache/yarn: Cannot mkdir: Permission denied tar: root/.cache/yarn/v6 ``` The problem is that we're sharing the Yarn cache between two jobs (`test_js` and `test_ios_unit_jsc`) which are executed on two difference executors (a Machine vs a Docker container). I've update the cache key to be `v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }}` so the job name is accounted when computing the Cache Key. Moreover the `test_js` test was also failing on `flow check` as one of the library we depend on (`resolve`) added a test with a malformed JSON. I'm fixing this failure as well so the CI is back green. ## Changelog [Internal] - Updating Yarn Cache path to fix broken CI Pull Request resolved: https://github.com/facebook/react-native/pull/32834 Test Plan: Verified that the external CI is green: https://github.com/facebook/react-native/pull/32834 Reviewed By: lunaleaps Differential Revision: D33453702 Pulled By: cortinico fbshipit-source-id: 52bf42db583eaf6aa913f1bb164566f8c3563d36 --- .circleci/config.yml | 6 ++++-- scripts/run-ci-e2e-tests.js | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1143cdf357..10be1045e89 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -78,7 +78,9 @@ commands: steps: - restore_cache: keys: - - v5-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} + - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }} + - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }} + - v5-yarn-cache-{{ .Environment.CIRCLE_JOB }} - run: name: "Yarn: Install Dependencies" command: | @@ -90,7 +92,7 @@ commands: - save_cache: paths: - ~/.cache/yarn - key: v5-yarn-cache-{{ arch }}-{{ checksum "yarn.lock" }} + key: v5-yarn-cache-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "yarn.lock" }} install_buck_tooling: steps: diff --git a/scripts/run-ci-e2e-tests.js b/scripts/run-ci-e2e-tests.js index af344facc52..177cb102339 100644 --- a/scripts/run-ci-e2e-tests.js +++ b/scripts/run-ci-e2e-tests.js @@ -19,7 +19,7 @@ * --retries [num] - how many times to retry possible flaky commands: yarn add and running tests, default 1 */ -const {cd, cp, echo, exec, exit, mv} = require('shelljs'); +const {cd, cp, echo, exec, exit, mv, rm} = require('shelljs'); const spawn = require('child_process').spawn; const argv = require('yargs').argv; const path = require('path'); @@ -265,6 +265,9 @@ try { throw Error(exitCode); } describe('Test: Flow check'); + // The resolve package included a test for a malformed package.json (see https://github.com/browserify/resolve/issues/89) + // that is failing the flow check. We're removing it. + rm('-rf', './node_modules/resolve/test/resolver/malformed_package_json'); if (exec(`${ROOT}/node_modules/.bin/flow check`).code) { echo('Flow check failed.'); exitCode = 1;