Unable to ignore file/directory in Cache

build-cache
step

#1

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.


#2

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!


#3

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


#4

Thanks for clarifying, sorry to hear that!

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


#5


This one had the environment variable set.


#6

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


#7

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.


#8

Testing it right now. Will update ASAP.


#9

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


#10

And the paths are starting with !?


#11

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


#12

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


#13

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


#14

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


#15

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.


#16

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


#18

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.


#19