Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random patch-package failures on CI #275

Open
ottoo opened this issue Nov 3, 2020 · 4 comments
Open

Random patch-package failures on CI #275

ottoo opened this issue Nov 3, 2020 · 4 comments

Comments

@ottoo
Copy link

ottoo commented Nov 3, 2020

I've tried the tips described in the readme and in one of the issues about creating a checksum of the patches folder but to no luck, I still keep getting random failures from patch-package on CircleCI. It's always the same package that fails, which is weird as well.

Any tips? I feel like I've tried everything, changing cache keys, trying to create a new patch file, the checksums..

The CircleCI config looks something like this with custom commands for loading/saving the cache

commands:
  save_yarn_cache:
    steps:
      - save_cache:
          key: &yarn_cache_key modules-v8-{{ checksum "yarn.lock" }}-{{ checksum "patches.hash" }}
          paths:
            - ~/.cache/yarn
            - node_modules
  yarn_install:
    description: 'Restore cache, run yarn install, and save cache'
    steps:
      - run: 
          name: Create patched package checksum
          command: md5sum patches/* > patches.hash
      - restore_yarn_cache
      - run:
          name: Yarn Install
          command: yarn install --frozen-lockfile
      - save_yarn_cache

The error:

**ERROR** Failed to apply patch for package apollo-server-cache-redis at path
  
    node_modules/apollo-server-cache-redis

  This error was caused because patch-package cannot apply the following patch file:

    patches/apollo-server-cache-redis+1.2.2.patch

  Try removing node_modules and trying again. If that doesn't work, maybe there was
  an accidental change made to the patch file? Try recreating it by manually
  editing the appropriate files and running:
  
    patch-package apollo-server-cache-redis
  
  If that doesn't work, then it's a bug in patch-package, so please submit a bug
  report. Thanks!

    ********github.com/ds300/patch-package/issues
    

error Command failed with exit code 1.
@joegoodall1
Copy link

joegoodall1 commented Nov 25, 2020

I'm seeing the same error on GitLab CI with iOS builds (works locally).

UPDATE Clearing runner caches seems to have fixed it.

@jehartzog
Copy link

We initially tried clearing the cache, but it quickly became painful as it would require going into CircleCI projects settings every time we patched a package. Additional, after we go to a cache number > 9, the CircleCI UI only shows the last digit, so we couldn't figure if it was at 10 or 20 or 200. It ended up being a minor time sink.

The correct way to fix this is to apply npx patch-package --reverse after the build is completed, but before the CircleCI cache is saved. See this discussion.

I recommend closing this issue, it was resolved for us by using the recommended solution.

@vasylnahuliak
Copy link

I'm seeing the same error on GitLab CI with iOS builds (works locally).

UPDATE Clearing runner caches seems to have fixed it.

Could you please share your GitLab config for caching patches?

@angelo-hub
Copy link

fwiw when running --reverse it also fails

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants