docker-orb icon indicating copy to clipboard operation
docker-orb copied to clipboard

Current cache-from configuration format doesn't allow for cache types

Open purajit opened this issue 1 year ago • 2 comments

Orb version

Current

What happened

When using cache-from: type=registry,ref=<registry>/<repo>:<tag>, I see

Pulling type=registry
invalid reference format
Pulling ref=ref=<registry>/<repo>:<tag>
invalid reference format

and essentially no caching behavior is observed.

Expected behavior

The entire argument should be taken as a single cache-from argument, instead of being split on the comma with each part assumed to be a different cache source. I'd suggest accepting a list. This behavior is extremely unexpected while trying to use this orb, and is a sufficient enough blocker to not use it at all.

Am I missing anything with how to use this config? I read through the code as well.

purajit avatar Aug 03 '24 01:08 purajit

The cache_from here is designed to work directly with type=registry, which is the default, so you would only need to specify the registry not the type, for example cache-from: mydockerimage:cache. I like the idea of having this parameter as a list, to allow the use of the other cache types, but for now that is a low priority functionality as most people uses only the registry type. For your example I suppose you are also using type registry, if you are using other type let me know, and we can prioritize this higher.

marboledacci avatar Sep 09 '24 14:09 marboledacci

Gotcha, yeah we're using registry caches, but this still prevents using other parameters like mode, image-manifest, oci-mediatypes, which are pretty critical (especially for multi-stage builds).

We resolved our issues by inlining our docker build instead, since we didn't want to rely layers of updates and abstractions, but if this arg is going to be useful, I think adhering to standard syntax is a must.

(Or, the limitations should be documented)

purajit avatar Sep 10 '24 08:09 purajit