satackey / action-docker-layer-caching

[CAUTION] This repository is not actively maintained. / Enable Docker layer caching in your GitHub Actions workflow.
https://github.com/marketplace/actions/docker-layer-caching
MIT License
421 stars 55 forks source link

Feature Request: Alternative, larger cache disk space #139

Open startakovsky opened 3 years ago

startakovsky commented 3 years ago

My workflow fails due to an out-of-memory issue during the Post Run step. I am wondering whether there is something simple I can do like point to another place which I can use to store and retrieve the cached layers.

Wish I could use your product but because we build 3 large images it seems that I am limited in memory. Thank you.

Output here:

System.IO.IOException: No space left on device
   at System.IO.FileStream.WriteNative(ReadOnlySpan`1 source)
   at System.IO.FileStream.FlushWriteBuffer()
   at System.IO.FileStream.Flush(Boolean flushToDisk)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
   at GitHub.Runner.Worker.Worker.RunAsync(String pipeIn, String pipeOut)
   at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args)
System.IO.IOException: No space left on device
   at System.IO.FileStream.WriteNative(ReadOnlySpan`1 source)
   at System.IO.FileStream.FlushWriteBuffer()
   at System.IO.FileStream.Flush(Boolean flushToDisk)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at GitHub.Runner.Common.HostTraceListener.WriteHeader(String source, TraceEventType eventType, Int32 id)
   at GitHub.Runner.Common.HostTraceListener.TraceEvent(TraceEventCache eventCache, String source, TraceEventType eventType, Int32 id, String message)
   at System.Diagnostics.TraceSource.TraceEvent(TraceEventType eventType, Int32 id, String message)
   at GitHub.Runner.Common.Tracing.Error(Exception exception)
   at GitHub.Runner.Worker.Program.MainAsync(IHostContext context, String[] args)
Unhandled exception. System.IO.IOException: No space left on device
   at System.IO.FileStream.WriteNative(ReadOnlySpan`1 source)
   at System.IO.FileStream.FlushWriteBuffer()
   at System.IO.FileStream.Flush(Boolean flushToDisk)
   at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.Diagnostics.TextWriterTraceListener.Flush()
   at System.Diagnostics.TraceSource.Flush()
   at GitHub.Runner.Common.TraceManager.Dispose(Boolean disposing)
   at GitHub.Runner.Common.TraceManager.Dispose()
   at GitHub.Runner.Common.HostContext.Dispose(Boolean disposing)
   at GitHub.Runner.Common.HostContext.Dispose()
   at GitHub.Runner.Worker.Program.Main(String[] args)
rcowsill commented 3 years ago

This error means the runner's SSD is filling up during the post run step. There's no way to avoid using the SSD, but you might be able to avoid the error by freeing up some SSD space before the cache upload.

Aside from that, this action does currently use a lot more space than it needs to. That's mainly caused by this issue in one of the dependencies: actions/toolkit#791.

mrserverless commented 2 years ago

You can save some disk space by deleting the following on Ubuntu (Android, Dotnet, Haskell):

rm -rf /usr/local/android /usr/share/dotnet /usr/local/share/boost /opt/ghc

this was mentioned in https://github.com/actions/virtual-environments/issues/2606

Also as a last resort use this plugin https://github.com/easimon/maximize-build-space

Ultimately the disk space of the GitHub runners isn't something that action-docker-layer-caching can address since all the runner sizes are fixed. There is a thread on this here https://github.community/t/bigger-github-hosted-runners-disk-space/17267