oss-fuzz icon indicating copy to clipboard operation
oss-fuzz copied to clipboard

Add support for Docker Layer Caching on GitHub Actions

Open pjbgf opened this issue 4 years ago • 5 comments

The GitHub Actions could support Docker Layer Caching so that users can save time and processing power when building fuzzers.

Such feature could be: a) Native - the entire caching is abstracted and exposed as a boolean flag (i.e. docker-cache-image). b) Partial - allow users to set a value for --cache-from to be using on docker build commands via a new input (i.e. docker-cache-from).

Would this be something the maintainers would be keen on? If so, I am happy to propose a PR.

pjbgf avatar Jan 13 '22 13:01 pjbgf

Is this for ClusterFuzzLite/CIFuzz or OSS-Fuzz?

jonathanmetzman avatar Feb 27 '22 02:02 jonathanmetzman

@jonathanmetzman this was for OSS-Fuzz CIFuzz build GitHub action. The reason I raised this was to speed up the build process, as in some cases we were experiencing north of 12 minutes for that step.

image

However, any other recommendations on speeding up that build process would also be appreciated.

pjbgf avatar Jun 29 '22 10:06 pjbgf

I think I'd probably accept a PR for this if you want to write one. Can you link me to that workflow run? I want to inspect the logs and see if I can find any interesting bottlenecks. I never implemented this earlier because I assumed the build was the limiting factor in most cases

jonathanmetzman avatar Jul 01 '22 16:07 jonathanmetzman

This would be extremely welcome. I'm adding CIFuzz right now, and the build time is pretty crazy, as there's no caching. See https://github.com/gravitational/teleport/runs/7688002902 for an example.

reedloden avatar Aug 05 '22 09:08 reedloden

Some resources to review:

  • https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching
  • https://github.com/marketplace/actions/docker-layer-caching (seems unmaintained)
  • https://depot.dev/blog/docker-layer-caching-in-github-actions
  • https://mmeendez8.github.io/2021/04/23/cache-docker.html

reedloden avatar Aug 05 '22 09:08 reedloden

FWIW I tried this docker caching solution a few months ago

  • https://github.com/ScribeMD/docker-cache/issues/304

The Action looked good but the image I need is just too big (12G) and it hit some hard github limits so I gave up.

My 2 cents, sorry if off-topic.

marc-hb avatar May 16 '23 21:05 marc-hb