-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
graph-builder: switch to using dkregistry and implement authenticated requests #4
graph-builder: switch to using dkregistry and implement authenticated requests #4
Conversation
28ff3a3
to
44a9c2a
Compare
1b8ad70
to
f983bff
Compare
b6b254e
to
103816b
Compare
9c8e925
to
aab6d10
Compare
aab6d10
to
dd96805
Compare
accebb5
to
e87459b
Compare
graph-builder/src/registry.rs
Outdated
.trim_left_matches("http://") | ||
} | ||
|
||
fn get_credentials_or_empty_reader(credentials_path: &Option<PathBuf>) -> Box<dyn std::io::Read> { |
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.
If you just inline this function, you can avoid the heap allocation. I don't think this helps much with readability.
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.
Using Box<dyn std::io::Read>
as the return type is the only way I've found to tell the compiler that all cases yield a reader. I've double-checked inlining this yesterday and couldn't make it work. Do you want me to triple-check?
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 managed to inline the functionality yet the Box
is still required. I suggest we leave it in and revisit on subsequent compiler releases.
3fc21d9
to
dec0bc6
Compare
cf736fc
to
1c8c844
Compare
1c8c844
to
835a368
Compare
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 haven't made it all the way through this yet. clippy
also has some suggestions you should follow.
graph-builder/src/registry.rs
Outdated
) { | ||
Ok(mut tags) => { | ||
if tags.len() == 0 { | ||
bail!("{}/{} has no tags", registry, repo); |
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 doesn't seem like an error condition.
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.
Please consider this in the answer to https://github.com/openshift/cincinnati/pull/4/files/835a3685c6c29f76bb999b96ec72f4ce00b37550#r233220468
if tags.len() == 0 { | ||
bail!("{}/{} has no tags", registry, repo); | ||
} | ||
tags.sort(); |
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.
Why bother sorting the list?
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 designed the tests in a way to expect a certain vector of results because the documentation says the tags are returned in a lexical sorted order. Quay seems to diverge from that so this sort enforces what the docker registry API documents.
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.
We should really try to avoid coupling to Quay as much as possible. CI cannot depend on it being up and they have already expressed concern over the amount of load we are putting on them. I'd rather we just adjusted our tests instead of the product.
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.
It's possible to neglect the order in the tests, with the downside of making a failed test more difficult to debug.
graph-builder/src/registry.rs
Outdated
.and_then(|tag_layer_digests| match tag_layer_digests { | ||
Ok((tag, layer_digests)) => { | ||
if layer_digests.len() == 0 { | ||
bail!("layer_digests list empty") |
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 doesn't seem like an error condition. We can handle this gracefully.
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.
Setting the context for the discussion: this is the case when there are no layers available for a discovered tag, which seems highly unexpected. Do you think it's better to just log the errors and drive the whole chain to completion and yield an empty result vector?
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. Logging the warning and then just returning an empty vector is fine.
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 haven't tested this behavior yet. It's not possible to upload an image without layers so this would include a bit of mocking.
9924ec2
to
ac7ac6f
Compare
Using the opportunity to update all dependencies.
7a80125
to
a594e53
Compare
rustfmt 0.99.6-nightly (750b252 2018-10-18)
… calls Switch to using dkregistry for all registry requests which supports asynchronous authenticated calls towards image registries. This commit also adds the parameter `--credentials-file` which takes a path to a JSON file as produced by `docker login`[1]. [1]: https://docs.docker.com/engine/reference/commandline/login/
a594e53
to
b074a25
Compare
/lgtm |
No description provided.