Unable to ignore file/directory in Cache

Hi,

I am trying to use the cache step with Xcode and everything is set up and working as expected in it’s most basic configuration. We set it up following this post: https://medium.com/@bitrise/60-faster-builds-force-xcode-to-use-caching-on-bitrise-af8979ca39a6
We have a problem though, since we are trying to exclude some files from the cache but we are failing.
Let’s say we have the directory:
~/Library/Developer/Xcode/DerivedData
We are successfully caching it. But then nested we have ~/Library/Developer/Xcode/DerivedData/app-ajzjxykzsqpgqcgmtbfjkruhblfz/Build/Intermediates.noindex/PrecompiledHeaders
and we want to exclude it from the cache.
We have tried including it in the Ignore Paths section of the cache, also setting the environment variable $BITRISE_CACHE_EXCLUDE_PATHS with no success.

Hi @Nuvolar_mobile_team! :wave:

Have you tried the methods specified here in our DevCenter?

In short, you’d have to use a “!” prefix for the path to get ignored.
Let us know if you’ve tired this and it still doesn’t seem operational!

Hi @bitce !
Yes, we have tried that, no luck. Folder is always there.

Thanks for clarifying, sorry to hear that!

Could you send us a build URL to be able to look into it please?

This one had the environment variable set.

Thanks! We’re looking into it and getting back to you ASAP!

1 Like

Hey @Nuvolar_mobile_team!

Could you please try it with all the paths using $HOME instead of ~? As far as I see there is an issue with the tilde expansion.

Testing it right now. Will update ASAP.

Replacing ~ with $HOME did not solve the problem. Files are still there.

And the paths are starting with !?

Yes.
The cache paths section looks like this:
$BITRISE_CACHE_DIR
$HOME/Library/Developer/Xcode/DerivedData -> $BITRISE_SOURCE_DIR/Podfile.lock

The Ignore Paths from change check:
!$HOME/Library/Developer/Xcode/DerivedData/**/PrecompiledHeaders

And after the new cache push step settings, did you clear cache and rebuild a new one?

Yes, I just tested again to make sure no mistakes were done.
Updated the settings.
Deleted all cache.
Triggered a new build.

The file can be found in:
/Users/vagrant/Library/Developer/Xcode/DerivedData/Contacts-dwwtmldvxrwqplastzljbzhnlptu/Build/Intermediates.noindex/PrecompiledHeaders

But where? In the archive? Or after Cache:Pull step? Or after the build?

Sorry if I was not clear enough.
After performing the previous steps and waiting for the build to complete, I downloaded the cache archive generated by bitrise. After expanding that archive, I could find in it the folder and files that were supposed to be excluded.

Seems like this pointer makes this happen actually. I am creating a ticket in out internal tracker to check this.
Thanks for the feedback!

1 Like

Hi @Nuvolar_mobile_team thanks for the report,
we released a new version (2.1.0) of Cache Push step, which fixes this issue.
Please update the step version to 2.1.0.