containerimage: Export option keys#3694
Conversation
exporter/containerimage/export.go
Outdated
| KeyPush = "push" | ||
| KeyPushByDigest = "push-by-digest" | ||
| KeyInsecure = "registry.insecure" | ||
| KeyUnpack = "unpack" | ||
| KeyDanglingPrefix = "dangling-name-prefix" | ||
| KeyNameCanonical = "name-canonical" | ||
| KeyStore = "store" |
There was a problem hiding this comment.
As a follow-up, we should consider;
- making these strong-typed (if possible)
- documenting these (some of them may be clear, but still may require some knowledge (what does this mean?)
I know @jedevc has done some work on improving such consts in other areas (happy to do the work, but I may need some input on the docs side of things)
There was a problem hiding this comment.
We could do this in a follow-up but these constants should not be defined in this pkg if they are public. If you want to use these keys, eg. to pass them from the client side, you should not need to pull in the server side implementation with all its dependencies.
This could either be in exptypes, or in a separate subpackage.
Good point, I was wondering (should've asked) if this was the right place for these; are these consts "common" between exporters, or specific to each? FWIW; this change is not "urgent" (we currently just duplicate them in moby/moby) but would be good to have in the next (v0.12) release, so I'd be fine to give it a bit more look and "do it correct" in a single PR (no need to rush this in). Perhaps that also allows us to combine it with #3694 (comment) |
|
Yeah, good point. I'll rework this PR. |
|
@vvoland @thaJeztah, I imagine there's a good chance you might want these in the next buildkit release? |
|
Looks like good to have (not critical but definitely good to have). Do we have pointers what package those consts should move to? |
|
|
43b79f7 to
c3fdce5
Compare
|
Done, also added some docs, please let me know if I wrote something silly there 😄 |
|
@jedevc any thoughts on #3694 (comment) (in case we want a type for these?) |
|
I think having a custom separate type (that's not just an alias) will cause a lot of churn in different places. The exporter type is passed as a plain string through the BuildKit control API, so we'd have to convert it out of that constantly. Nothing else in |
Yes, makes sense. I had #3199 in mind, where we ultimately decided to go for strong-typed (which wasn't too bad w.r.t. casting strings to types), but must admit I haven't looked how much impact the consts in this PR would have. (Was just considering: if we want to do it, this might be a good occasion to do so) |
c3fdce5 to
718b1a8
Compare
|
Moved other exporter keys and changed the keys to be strongly typed. It doesn't seem to involve that much type-casting, although it makes it a bit weird for the external consumer to assign them to a |
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
6d6b719 to
6443a6a
Compare
|
Failure looks unrelated: |
I gave CI a kick |
|
Not for this PR, but while looking at a ticket in moby/moby (moby/moby#45665), I discovered more strings in there that have non-exported consts defined in BuildKit; consts are in the dockerfile frontend; buildkit/frontend/dockerui/config.go Lines 26 to 51 in 80b91c5 Perhaps we should look at those as well 🤔 - let me create a ticket for that. |
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
b1d3836 to
d82a803
Compare

Make containerdimage attribute key names public, to make it easier for some downstream projects to use them without hardcoding them on their side 😅 .