Builds started to fail if using yarn cache (even from the same pull request)

Error began happening around 09/06/2020.

Pull request that shows travis pass one build for the /travis-ci/push but fail the build for /travis-ci/pr: https://github.com/uw-it-edm/content-services-ui/pull/1086

Passed build: https://travis-ci.org/github/uw-it-edm/content-services-ui/jobs/725409114
Failed build: https://travis-ci.org/github/uw-it-edm/content-services-ui/jobs/725412898

Notes:

  • As far as I can tell, the difference is that the build that passed did a full yarn install, while the one that failed got it from cache.
  • I tried manually deleting all caches from the repo by using travis UI, but the build still fails.
  • This same error happens in all other builds during this time (PR’s and branches).
  • I was able to move past this error by disabling the yarn cache from the travis.yml file, but we would like to be able to re-enable it to speed up the builds.

Hey @farmas,

Took a look at both of your .travis.yml files, do you know if

yarn || true && yarn && yarn test

Succeed? This would be telling for me on a couple of things!

-Montana
Travis CI Staff

Hello Montana, I don’t understand where should I put that line inside of the travis.yml file.

AFAICS, he wants you to do, within a single job and without cleaning the cache:

  1. A normal Yarn build and ignore its outcome, then
  2. A second identical Yarn build, then
  3. If it succeeds, a test run.

This is going to tell if your cache is incomplete or otherwise missing something required for a successful build AFAICT.

So you need to put that command (or rather, its equivalent if you require some additional arguments to yarn) in place of your current yarn build command.