I’d like to ask for the support of ccache cache in build.snapcraft.io as it can minimize build time.
Unfortunately I don’t believe that’s easily possible. The build machines you’re using are stood up from clean on each build. They’re then torn down after. So there would be no cache between one build and the next.
Travis CI managed to achieve this by packing and uploading the cache somewhere after building and pull it back at the start of the build:
Their implementation appears to be:
Interesting! I wasn’t aware of that. @evan ‘owns’ build.snapcraft.io from a product perspective, so I’ll defer to him as to whether we could / would implement this.
Just for reference, the setup in the build container:
$ ccache --show-stats
cache directory /home/travis/.ccache
cache hit (direct) 87
cache hit (preprocessed) 61
cache miss 84
called for link 2
called for preprocessing 40
preprocessor error 8
bad compiler arguments 8
autoconf compile/link 44
no input file 27
files in cache 225
cache size 181.1 Mbytes
max cache size 512.0 Mbytes
You could file this as a bug against Launchpad itself, which is where anything like this would need to be implemented. That said, my instinct is that anything like this would require a great deal of care to avoid accidentally creating security vulnerabilities due to multi-tenanting and information leaks between builds via ccache data; it would be a large project to do this safely, and until we could be absolutely confident in its safety, it’s more valuable to have certainty that each build is strongly isolated from the next.
I’ve filed the bug to Bug #1776898 “Build.snapcraft.io: Support ccache cache” : Bugs : Launchpad itself.