chainguard-dev / apko

Build OCI images from APK packages directly without Dockerfile
https://apko.dev
Apache License 2.0
1.21k stars 125 forks source link

Drop errgroup.WithContext and add withCause #1380

Closed jonjohnsonjr closed 3 weeks ago

jonjohnsonjr commented 3 weeks ago

We are sometimes unable to expand an APK into our cache due to an opaque "context canceled" error. This change attempts to address that in two ways.

First, we drop our use of errgroup.WithContext when installing packages. If one package fails to install, we'll let the rest run to completion so that we make more forward progress towards populating the cache (if there is one). Even though the overall operation will still fail, in cases where that failure was transient, we avoid throwing away in-flight work towards the other packages.

Second, we'll try to extract a cause for the context cancellation and annotate the errgroup's error with it so that we know why the overall operation was canceled.

At least one of these changes should help determine what's going on.