Does clear cache work for 2.0?

cache

#1

Rebuild without cache works, but I tried clearing my cache via project settings but that doesn’t seem to be working.


#2

This does not currently work in 2.0.

The best way to invalidate the cache is to either rebuild without cache as you have already done, or update the cache key (in circle.yml) to one that does not exist.

These are not ideal, but its what we have for now.

Thanks!
Lev


#3

Hi @levlaz,

seems to be that cache restore is broken:

Found a cache from build 917 at my-cache
Size: 35 MB
Cached paths:
  * /home/app/node_modules

Downloading cache archive...
Unarchiving cache...
Error untarring cache: exit status 1

#4

Caches are restoring okay. Are you seeing an issue restoring your cache? Does it persist through more than one build? If so, can you link me to it?


#5

This is how I do it:

      # Install dependencies
      - restore_cache:
          key: my-app-{{ checksum "package.json" }}
      - run:
          name: Install dependencies
          command: npm install
      - save_cache:
          key: my-app-{{ checksum "package.json" }}
          paths:
            - /home/app/node_modules

#6

So it’s working?


#7

No, this is my configuration that I use and throws the “Error untarring cache: exit status 1” at restore.


#8

Please link me to it so I can properly report it. You can PM it to me.


#10

Yup, it does not work for me too.

Im using machine executor.


#11

Happening to me on branch builds… with docker executor

- restore_cache:
      keys:
          - project-{{ .Branch }}
          - project-master  

error message

No cache is found for key: project-staging
Found a cache from build 416 at project-master
Size: 955 kB
Cached paths:
  * /var/cache/apk
  * /go/src/github.com/kardianos/govendor

Downloading cache archive...
Unarchiving cache...
Error untarring cache: exit status 1

#12

Can you try restoring the cache without a checkout step?

Another thing to try is to mv tar and replace it with a debug script. If you give me permission to run some tests on your build, I’d just run some builds via the API with my own config to debug.


#13

I’m running into the same error (Error untarring cache: exit status 1). Cache restore works for a different project, but that one uses Ubuntu, and the project I’m having the issue with uses AlpineLinux. Perhaps that’s the problem.

I’ve opened a support request for this as well, to give permission to debug if it gets to that.


#14

Looks like for alpine linux, adding apk add tar gzip fixes it.


#15

Perhaps that error message could get some love? It really should say what the caused the exit status 1.


#16

We are looking to improve communication across the board.


#18

This (or rebuild without cache + ssh) is very important for us… right now when we have a broken build that has a wrong cache, I can either ssh into it (with a wrong cache and have to recreate everything from scratch), or build without cache, but then can’t investigate the problem.

Is there any plans for making this work?


#19

Is there update on that feature? I’m also looking forward to the reintroduction of the button “Rerun job without cache” (or even better - “Rerun workflow without cache”).


#20

@tklo, I’m not sure about the official status, but I can say things are not working as expected.

I have a v2 project, and I changed a directory. A file in the cache points to the old non-existing directory. So when it builds, it fails. I build without cache, and it succeeds! But when it builds again, it fails for the same reason! The cache should have been updated or invalidated by the “build without cache” run, but it isn’t. I remember this used to work when 2.0 first came out, but hasn’t been since I started reusing it all this week.


#21

Having the same issue - very frustrating as build without cache skips saving new cache altogether


#22

As many others, I too am encountering issues with Circle 2.0 caching problems. I wish there was a way to invalidate cache keys to attempt to force the cache to try to match an existing cache.

No cache is found for key: npm-deps-EmKu8k1W4PQPaf7AYB5eYdrMthiELgHf6HLE9EB1HjA=
Found a cache from build 13378 at npm-deps-
Size: 56 MB
Cached paths:
  * /home/circleci/project/node_modules

Downloading cache archive...
Validating cache...

Unarchiving cache...

Then after the cache misses and the dependencies are installed, it tries to save the cache, but the same cache already exists so it skips.

Skipping cache generation, cache already exists for key: npm-deps-_a9RJklQj5FgCunHFNWudLxhSOi9LTma8WF5QYKbXUs=
Found one created at 2018-02-22 22:38:33 +0000 UTC

The configuration for restoring and saving the cache are keyed identically.

keys:
  - npm-deps-{{ checksum "yarn.lock" }}

It is frustrating.