Hello, I’m looking into automating clearing the build cache from a workflow instead of going in the settings and manually deleting the cache.
I tried creating a workflow that would only do a “cache-push” step and nothing else. But that didn’t seem to clear it.
Anyone know of another way?
Currently there is no step or any other automatized option to delete your cache, though they do get automatically deleted after 7 days if unused.
Could you give a bit more detail as to why you would need this feature? You can also have workflows that simply don’t include the Cache:Pull step (and this not use cache), or you can give a condition to the step to only run in certain conditions: Enabling or disabling a Step conditionally | Bitrise DevCenter
Thanks for the feedback! My team needs this feature because we support multiple internal libraries that in one of our project are updated pretty frequently (multiple times a day). This causes our cache to grow in size pretty rapidly. From less than 2 GB on the first cache push to more than 8GB in 2 weeks. So doing a clean up once every week or two would ensure us that our cache is clean and takes a reasonable time to pull and push.
The good news is that I found an easy way to do this. Here are the steps in case anyone sees this post in the futur :
- Download your cache in “Settings > Manage Build caches” and check which paths are being cached.
- Create a new empty workflow
- Add a script step and a cache push step
- In the script step create the directories you would want to be cleaned from the cache. For me, it was the ~/.gradle directory. I also added a bit of logic to only run the script every 2 weeks.
- Add this path to the “Cache paths” of the cache push step.
- Schedule a build every week on the branch that has the cache.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.