-
Notifications
You must be signed in to change notification settings - Fork 395
Add LoadTarManifest to get the manifest from docker-archive #309
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
Conversation
|
@rhatdan PTAL |
|
We are going to need similar functionality to this to get the tags out of the oci image spec. |
mtrmac
left a comment
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.
Just adding the method to Source is a much better than my proposal of splitting Source into two.
Still, loadTarManifest should be split into two: “just load everything” and “load + check that there is only one manifest”.
| return nil, errors.Wrap(err, "Error decoding tar manifest.json") | ||
| } | ||
| if len(items) != 1 { | ||
| return nil, errors.Errorf("Unexpected tar manifest.json: expected 1 item, got %d", len(items)) |
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 check should remain in place when using Source as a types.ImageSource backend.
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.
Can we move it to the other function? The only one that calls this? Then we would only have one loadmanafest function.
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.
@mtrmac I added the error check in ensureCachedDataIsPresent() after loadTarManifest() is being called.
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.
That’s better, sure.
| } | ||
|
|
||
| // LoadTarManifest loads and decodes the manifest.json | ||
| func (s *Source) LoadTarManifest() ([]manifestItem, 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.
Is it acceptable to return a private type from a public function? AFAIK the caller won’t be able to refer to the type in parameter/return value declarations.
(If it works for you, fine; just make sure that it does.)
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 is working in her current code.
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.
Yup it works fine. I looked it up and a private type can be accessed from an exported function, but the private type can't be created outside its own package.
Need it in kpod pull and kpod load. These commands need all the manifests, so took out the length checking block from loadTarManifest. Signed-off-by: umohnani8 <umohnani@redhat.com>
|
@runcom PTAL |
Need it in kpod pull and kpod load. These commands need all the manifests, so took out the length checking block from loadTarManifest.
Signed-off-by: umohnani8 umohnani@redhat.com