Skip to content
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

OCI base image support is likely to be fishy or even not working #1683

Closed
chanseokoh opened this issue May 1, 2019 · 0 comments · Fixed by #1687
Closed

OCI base image support is likely to be fishy or even not working #1683

chanseokoh opened this issue May 1, 2019 · 0 comments · Fixed by #1687
Assignees

Comments

@chanseokoh
Copy link
Member

We does accept OCI manifest and read it into OCIManifestTemplate in memory.

  • ManifestPuller
    if (schemaVersion == 2) {
      // 'schemaVersion' of 2 can be either Docker V2.2 or OCI.
      String mediaType = node.get("mediaType").asText();
      ...
      if (OCIManifestTemplate.MANIFEST_MEDIA_TYPE.equals(mediaType)) {
        return manifestTemplateClass.cast(
            JsonTemplateMapper.readJson(jsonString, OCIManifestTemplate.class));
      }

readJson() above returns an OCIManifestTemplate object (which is cast into the super ManifestTemplate by .cast()).

But, when we re-cast the in-memory object, we case it into either V21ManifestTemplate or V22ManifestTemplate.

  • PullBaseImageStep
    ManifestTemplate manifestTemplate =
        registryClient.pullManifest(buildConfiguration.getBaseImageConfiguration().getImageTag());

    // TODO: Make schema version be enum.
    switch (manifestTemplate.getSchemaVersion()) {
      case 1:
        V21ManifestTemplate v21ManifestTemplate = (V21ManifestTemplate) manifestTemplate;
        ...

      case 2:
        V22ManifestTemplate v22ManifestTemplate = (V22ManifestTemplate) manifestTemplate;
        ...

So although I haven't tested myself, I think Jib will throw class cast exception.

Also, we should have a "default" case in the above switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants