-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Prepare JSON template classes for new manifest cache design #2707
Conversation
Note /** Parent class for image manifest JSON templates. */
@JsonIgnoreProperties(ignoreUnknown = true)
public interface ManifestTemplate extends JsonTemplate {
int getSchemaVersion();
} Also the only place where jib/jib-core/src/main/java/com/google/cloud/tools/jib/image/ImageTarball.java Lines 113 to 118 in 3ba06f9
Note we don't support reading an OCI image index for a base image at all. jib/jib-core/src/main/java/com/google/cloud/tools/jib/registry/AbstractManifestPuller.java Lines 82 to 87 in 3ba06f9
|
I wonder if we're using explicit type information, then it makes sense to only use a complex json cache entry for manifest list/oci index and simpler entries for single images?
or
I'm not super sure what the consequences of this are though. |
Ah, that's a very natural idea. There's one thing related though. For the cache retrieval method public Optional<ImageMetadataTemplate> retrieveMetadata(ImageReference imageReference) (Did not want to create another class for a return type that is fundamentally same as So, if we were to use different top-level classes for Initially I thought returning |
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 seems fine. Just questions for my understanding.
property = "@class") | ||
@JsonSubTypes({ | ||
@JsonSubTypes.Type(value = OciManifestTemplate.class), | ||
@JsonSubTypes.Type(value = V21ManifestTemplate.class), |
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.
Do we need to persist a V21 manifest? Don't we do conversions of this to V22?
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 don't actually do a JSON-to-JSON conversion. We are currently persisting V21ManifestTemplate
in the cache.
It's just that we can properly instantiate a Java Image
instance from both V21 and V22.
@@ -110,7 +110,7 @@ | |||
|
|||
if (schemaVersion == 1) { | |||
return Optional.of( | |||
new ManifestAndConfig( | |||
new ManifestAndConfigTemplate( |
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 seems strange that we would generate a JsonTemplate type from separately parsed out jsonTemplates? Is this something that we would need to change eventually?
Can we go directly to ManifestAndConfigTemplate directly from 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.
In the next PR, all of these parsing and conversion operations will be gone, and this retrieveMetadata()
will directly de-serialize and return ImageMetadataTemplate
without any processing.
Renaming
ManifestAndConfig
toManifestAndConfigTemplate
.Optional<>
to@Nullable
.New class:
ImageMetadataTemplate
.List<ManifestAndConfigTemplate>
).For example,
OciImageIndex
now inheritsManifestTemplate
(previouslyJsonTemplate
). This is to have a slightly more specialized class as a common super class ofOciImageIndex
andV22ManifestListTemplate
.ManfiestTemplate
is also a super class ofOciManifestTemplate
,V21ManifestTemplate
andV22ManifestTemplate
. It does make sense to consider all of these manifest list classes and manifest classes asManifestTemplate
.@louismurerwa