-
Couldn't load subscription status.
- Fork 62
lib/repository2: add support for docker v2.2 and OCI #176
Conversation
|
Right now docker2aci is relying on the docker hub rewriting manifests into the v2.1 schema for it. Also I want to write a test or two for this before it gets merged, so that will come next week. |
|
@iaguis @s-urbaniak review? |
|
|
||
| copier := progressutil.NewCopyProgressPrinter() | ||
|
|
||
| var errChannels []chan error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason why we cannot use a single (buffered) channel)? The amount of err's is known in forehand.
|
@s-urbaniak switched to using a single buffered channel, as per your suggestion |
|
@dgonyeo that was quick ;-) thanks for the quick update. How did you test this locally? I'd like to play with it tomorrow morning. |
|
I pointed it at the docker hub (i.e. For the tests I'm going to write this week I intend to spin up a local distribution, but docker2aci gets upset when the local distribution responds to its https request with http, so I might need to tweak |
| } | ||
| for i := 0; i < len(layerIDs); i++ { | ||
| res := <-resultChan | ||
| defer res.closer.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will panic if res.closer is nil which can happen if you return an err.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can just swap with the err check below to prevent this.
2240086 to
e7ff0f6
Compare
|
@s-urbaniak how's it look now:
|
|
@dgonyeo 👍 ... those dreaded resources ;-) Another idea I had to omit those lgtm from my side, didn't make it to test today though, will do so tomorrow. |
|
@dgonyeo out of curiosity: why do we need to bubble up those response bodies (closer) up through the channel? Can't we close them earlier? |
|
@s-urbaniak: those response bodies can't be closed until the |
|
bump - what's left? more review? |
|
Still lgtm from my side, just had a small implementation question. |
|
Just realized that I never correctly added the annotations to the new manifest after doing the v2.2 -> AppC manifest conversion, so just updated this commit to fix that. |
|
And just added a commit that tweaks the tests to run them against a local registry in addition to running them on local files. The tests aren't as comprehensive as I wanted, but I couldn't find an easy way to generate/seed the registry with differing versions of docker images. This at least hits the fetching logic a few times. |
|
@s-urbaniak final review? |
| if res.err != nil { | ||
| errs = append(errs, res.err) | ||
| } | ||
| layerFiles[res.index] = res.file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
res.file can be nil in case of an err, hence layerFiles[res.index] will be nil too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like this is taken care of, res always has index now
|
Found two small nits, else LGTM |
| }() | ||
| } | ||
| var errs []error | ||
| for i := 0; i < len(layerIDs); i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for res := range resultChan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I didn't know you could range over channels. But resultChan never gets closed, so wouldn't the for loop never exit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, if you don't close the channel, range will block forever.
|
Couple of nits but also LGTM overall |
This commit adds support for the docker v2.2 image format and OCI image format. When the remote registry supports the docker v2 HTTP API, docker2aci will add the media types for v2.1, v2.2 and OCI to the Accept header on the manifest request, and handle the returned manifest version accordingly.
|
Oh, also added a gitignore because things in |
|
@dgonyeo ping, is it ready for merge? |
|
I believe it is. |
|
Sorry for the delay, I was confused who is supposed to merge. |
This commit adds support for the docker v2.2 image format and OCI image
format. When the remote registry supports the docker v2 HTTP API,
docker2aci will add the media types for v2.1, v2.2 and OCI to the Accept
header on the manifest request, and handle the returned manifest version
accordingly.