react-native-circleci-orb
react-native-circleci-orb copied to clipboard
Restoring Cache : Failling to unarchive cache
Hitting problems when trying to rerun a build. the pre Yarn install step of Restoring the Cache is failing, is there a way around skipping this step,
Orb version
4.4.2
What happened
Fails to unarchive cache
Size: 324 MiB
Cached paths:
* /tmp/yarn
Downloading cache archive...
Validating cache...
Unarchiving cache...
Failed to unarchive cache
Error untarring cache: Error extracting tarball /var/folders/1b/gl7yt7ds26vcyr1pkgld6l040000gn/T/cache984330157 : tmp/yarn/: Cannot extract through symlink tmp/yarn tmp/yarn/v4/: Cannot extract through symlink tmp/yarn/v4 tmp/yarn/v4/.tmp/: Cannot extract through symlink tmp/yarn/v4/.tmp tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/: Cannot extract through symlink tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/: Cannot extract through symlink tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/@babel/: Cannot extract through symlink tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/@babel tmp/yarn/v4/npm-@babel-code-frame-7.8.3-33e25903d7481181534e12ec0a25f16b6fcf419e/node_modules/@babel/code-frame/: Cannot extract through symlink tmp/yarn/v4/[email protected]: exit status 1
Expected behavior
Use previous cache and carry on with the Yarn install
@Naturalclar I see you recently touched this in https://github.com/react-native-community/react-native-circleci-orb/pull/59. On what type of runner were you experiencing the problems (mac/linux)?. Any idea what can be wrong? I'm also seeing this, on a mac runner. Thanks.
Started getting this error as well. Orb version: 4.4.2
Confirm it's happening on 4.4.2 only on Mac environment for me
Some more info, in my case it says
Found a cache from build 559 at yarn-cache-arch1-darwin-amd64-6_58-...
But I'm now at build 592, is there a way to say if restoring the cache goes wrong then ignore it and install everything from scratch?
After reading this
https://support.circleci.com/hc/en-us/articles/115015426888-Clear-project-dependency-cache
I set an environment variable CACHE_VERSION
with value v2
and it seems like it solved the issue.
@mtt87 when you first set it, you have changed the comparitor and so it won't be able to find a valid cache to use...thus it creates a new one and everything works.
I found that on the next attempt to build it will use your value v2
and find a matching cache, try to unarchive it and you'll get the same error as before.
Damn, that's a good point I'll try again soon to verify if it still happening.
Have you tried to downgrade to 3.2.2 to see if it works?
Yes - we downgraded and await a fix to this
Facing the same issue on xcode: 11.5.0
orb 4.4.2
, solved running a simple yarn install --frozen-lockfile --non-interactive
since I don't need to cache this folder at a specific step.
Seeing this issue as well with 4.4.2
Facing the same issue here: https://app.circleci.com/pipelines/github/react-native-community/react-native-viewpager/296/workflows/f47a2400-fc43-4aec-aedd-a3cafb80ed3e/jobs/972
in this PR: https://github.com/react-native-community/react-native-viewpager/pull/201
Latest working version for me it's 4.2.2
FYI in case you wanna downgrade
The same for 4.2.2
https://app.circleci.com/pipelines/github/react-native-community/react-native-viewpager/302/workflows/f9554c1e-5dd8-4f27-ac8c-9745aae7e63c/jobs/993
Android works fine, but iOS does not work.
Add an env variable to your project if you don't already have it CACHE_VERSION
and use 2
, or if you already have it, increase it.
I remember this fixed it for me with 4.2.2 and it still works today
We're finding that we need to change the CACHE_VERSION
for every run, and so far we've only found a way to do it manually by changing the project settings.
We're finding that we need to change the
CACHE_VERSION
for every run, and so far we've only found a way to do it manually by changing the project settings.
With version 4.4.2 I have the same experience with the rn/ios_build
job. I set all of this up with Android weeks ago, and the save/restore from cache has been flawless. Setting up the iOS side has been more of a pain.
Here is how we are using the rn
orb's job in our workflow. It mostly matches the examples in the documentation (some names withheld to protect the innocent):
- rn/ios_build:
build_configuration: Debug
detox_configuration: ios.sim.staging
device: iPhone 11 Pro
name: build_ios_debug
node_version: '12.18'
project_path: ios/ProjectName.xcworkspace
project_type: workspace
scheme: ProjectName-staging
start_metro: true
requires:
- analyze_js
# β We changed that to the American spelling :) πΊπΈ
- The build fails with an error like this:
Found a cache from build 2500 at yarn-cache-arch1-darwin-amd64-6_58-CtErNzrQbrt0boxXcoHOSPYkhQO77C0mVdN+cOWwdlQ=-pkNLpKB43oV0NLrI2IjZ4BpTEqiMriIdA7xqTvUeC04=-v3
Size: 378 MiB
Cached paths:
* /tmp/yarn
Downloading cache archive...
Validating cache...
Unarchiving cache...
Failed to unarchive cache
Error untarring cache: Error extracting tarball /var/folders/1b/gl7yt7dS26vcyr1pkgld6l050000gn/T/cache789244379 : tmp/yarn/: Cannot extract through symlink tmp/yarn tmp/yarn/v4/: Cannot extract through symlink tmp/yarn/v4 tmp/yarn/v4/.tmp/: Cannot extract through symlink tmp/yarn/v4/.tmp tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403 tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.buckconfig: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.buckconfig tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.editorconfig: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.editorconfig tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintignore: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintignore tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintrc.js: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintrc.js tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.flowconfig: Cannot extract thro: exit status 1
- We go to the Circle CI environment variables, remove the
CACHE_VERSION
, and then add new variable with the same name but an incremented value.- e.g., remove
CACHE_VERSION
with value ofv2
and addCACHE_VERSION
with a value ofv3
- example url for Circle Environment Variables β
https://app.circleci.com/settings/project/github/your-org-name/your-repo-name/environment-variables
- e.g., remove
The cache is successfully restored on the next run, but will fail on subsequent runs. It seems like the restore from cache has somehow changed on a macos
executor.
Next steps for me
My next steps are to use the individual commands from the rn
orb mixed in with my own save/restore cache commands, though I would love to use the orb here instead!
Hi guys! Did any found a solution or workaround to this issue?
I'm also still running into the same issue
Looking into this.
We had to make the swissknife and react-native orbs local to our setup (we have unoffical orbs disabled).
But this means I can make changes!
So, investigating leads me to these links:
- https://circleci.com/docs/2.0/caching/#yarn-node
- https://circleci.com/docs/2.0/yarn/
- outcome: don't use
/tmp/yarn
for the cache, it might be on a different FS that doesn't treat symlinks as you might expect.
- outcome: don't use
The other thing I noticed was that for monorepos, caching will need to be more nuanced:
-
https://www.benpickles.com/articles/77-caching-yarn-workspaces-on-circleci
-
https://discuss.circleci.com/t/list-parameter-type/26705/6
We're finding that we need to change the
CACHE_VERSION
for every run, and so far we've only found a way to do it manually by changing the project settings.With version 4.4.2 I have the same experience with the
rn/ios_build
job. I set all of this up with Android weeks ago, and the save/restore from cache has been flawless. Setting up the iOS side has been more of a pain.Here is how we are using the
rn
orb's job in our workflow. It mostly matches the examples in the documentation (some names withheld to protect the innocent):- rn/ios_build: build_configuration: Debug detox_configuration: ios.sim.staging device: iPhone 11 Pro name: build_ios_debug node_version: '12.18' project_path: ios/ProjectName.xcworkspace project_type: workspace scheme: ProjectName-staging start_metro: true requires: - analyze_js # β We changed that to the American spelling :) πΊπΈ
- The build fails with an error like this:
Found a cache from build 2500 at yarn-cache-arch1-darwin-amd64-6_58-CtErNzrQbrt0boxXcoHOSPYkhQO77C0mVdN+cOWwdlQ=-pkNLpKB43oV0NLrI2IjZ4BpTEqiMriIdA7xqTvUeC04=-v3 Size: 378 MiB Cached paths: * /tmp/yarn Downloading cache archive... Validating cache... Unarchiving cache... Failed to unarchive cache Error untarring cache: Error extracting tarball /var/folders/1b/gl7yt7dS26vcyr1pkgld6l050000gn/T/cache789244379 : tmp/yarn/: Cannot extract through symlink tmp/yarn tmp/yarn/v4/: Cannot extract through symlink tmp/yarn/v4 tmp/yarn/v4/.tmp/: Cannot extract through symlink tmp/yarn/v4/.tmp tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403 tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.buckconfig: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.buckconfig tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.editorconfig: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.editorconfig tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintignore: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintignore tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintrc.js: Cannot extract through symlink tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.eslintrc.js tmp/yarn/v4/.tmp/ae76De6c779b0c17fc78aa8d370ed403/.flowconfig: Cannot extract thro: exit status 1
We go to the Circle CI environment variables, remove the
CACHE_VERSION
, and then add new variable with the same name but an incremented value.
- e.g., remove
CACHE_VERSION
with value ofv2
and addCACHE_VERSION
with a value ofv3
- example url for Circle Environment Variables β
https://app.circleci.com/settings/project/github/your-org-name/your-repo-name/environment-variables
The cache is successfully restored on the next run, but will fail on subsequent runs. It seems like the restore from cache has somehow changed on a
macos
executor.Next steps for me
My next steps are to use the individual commands from the
rn
orb mixed in with my own save/restore cache commands, though I would love to use the orb here instead!
@m2mathew Appreciate the detailed explanation. I am very new to Circle CI and I couldn't for the life of me figure out how to set environment variables, for those having the same issue as me, i.e. where the hell do you set CACHE_VERSION
, as Mathew suggested, it is in the Circle CI UI and here is the link:
https://app.circleci.com/settings/project/github/your-org-name/your-repo-name/environment-variables
@airtonix Would you mind sharing your "swissknife and react-native orbs local to our setup" approach ?
Hi, I'm dealing with this issue, and I have to change the CACHE_VERSION almost every new PR, do we have a better workaround to fix this bug in the meantime?
Hi, I'm dealing with this issue, and I have to change the CACHE_VERSION almost every new PR, do we have a better workaround to fix this bug in the meantime?
Have you checked this post? @Jose4gg https://support.circleci.com/hc/en-us/articles/360056920051--Error-untarring-cache-when-running-a-macOS-job
This is still happening, v5.0.0 on the rn/ios_build
step.
My config at this step:
- rn/ios_build:
name: build_ios_release
project_path: ios/MyApp.xcodeproj
device: "iPhone 12"
build_configuration: Release
scheme: MyApp
requires:
- analyze_js
Here's the entire error:
Found a cache from build 846 at yarn-cache-arch1-darwin-amd64-6_58-D0_AuAkbuS7gt7h+QkuuifdD4ggj_6o0mKXP8aewiEQ=-XUzc4oblUuD6VhRoBYEv7OCtEibCDWiNuAbxRwyDlRk=-v4
Size: 275 MiB
Cached paths:
* /tmp/yarn
Downloading cache archive...
Validating cache...
Unarchiving cache...
Failed to unarchive cache
Error untarring cache: Error extracting tarball /var/folders/6y/gy9gggt14379c_k39vwb50lc0000gn/T/cache725626886 : tmp/yarn/: Cannot extract through symlink tmp/yarn tmp/yarn/v6/: Cannot extract through symlink tmp/yarn/v6 tmp/yarn/v6/.tmp/: Cannot extract through symlink tmp/yarn/v6/.tmp tmp/yarn/v6/[email protected]/: Cannot extract through symlink tmp/yarn/v6/[email protected] tmp/yarn/v6/[email protected]/node_modules/: Cannot extract through symlink tmp/yarn/v6/[email protected]/node_modules tmp/yarn/v6/[email protected]/node_modules/@babel/: Cannot extract through symlink tmp/yarn/v6/[email protected]/node_modules/@babel tmp/yarn/v6/[email protected]/node_modules/@babel/code-frame/: Cannot extract through symlink tmp/yarn/v6/[email protected]/node_modules/@babel/code-frame tmp/yarn/v6/[email protected]/node_modules/@babel/code-frame/.yarn-metadata.json: Cannot extract through symlink tmp/yarn/v6/[email protected]: exit status 1
I've opened a potential PR for this.
Hello, I talked with Matt and he does not have time for OSS so he likely won't be responsive in this repo going forward. While I'm also reducing my free time that I spend with open source, I will be available here to review and merge pull requests.
regarding this issue, I believe it was caused by https://github.com/react-native-community/react-native-circleci-orb/pull/59
The solution is that someone who is bothered by this issue should investigate the proper fix and contribute a PR. Thank you for your understanding! π
Thanks for the message @vonovak! It's true that I'll likely be stepping back for this a bit more and I'm happy for any help that anyone can provide on this.
Seeing as this is a common issue, and I had a spare half hour, I've implemented a workaround to allow you to disable caching using parameters on the commands and jobs. Details are in this commit and it's released in v5.1.0.
This is only a workaround to allow you to move forward with no cache, but I agree that someone who's experiencing this issue should look into a proper fix which allows the cache to be kept there as it can vastly speed up build times.
Thanks @matt-oakes and @vonovak for the quick response. Being able to disable the cache will definitely help for now. I've submitted a fix (#88), however I'm not entirely sure this a full fix, but it does allow the caches to be used.
I submitted PR #103 which made it into orb version 5.4.0. This allows you to undo the pathing change that seemed to have introduced this issue. You can achieve that by using yarn_cache_folder: ~/.cache/yarn
in the ios_build or ios_build_and_test jobs.
I've run my build several times with this config change and haven't run into the permissions issue that drove that breaking change initially.
I submitted PR #103 which made it into orb version 5.4.0. This allows you to undo the pathing change that seemed to have introduced this issue. You can achieve that by using
yarn_cache_folder: ~/.cache/yarn
in the ios_build or ios_build_and_test jobs.I've run my build several times with this config change and haven't run into the permissions issue that drove that breaking change initially.
As a note for anyone planning on utilising this new yarn_cache_folder
, just be aware that changing to the orb v5.4.0 and adding the new cache param above may still match the old location /tmp/yarn
if there exists a matching checksum (I just had this) - I just chose to upgrade a package I was already planning on upgrading anyway, so they stopped matching and now the restore goes through perfectly!
Thanks @ronwsmith - this was a real pain point when i got the orb setup a few months ago lol
Any update on this? getting the same error now.