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

Support OCI artifacts #1574

Merged
merged 14 commits into from Jun 17, 2022
Merged

Support OCI artifacts #1574

merged 14 commits into from Jun 17, 2022

Commits on Jun 16, 2022

  1. Clean up PreserveOriginal comments

    One of the is fine, but better placed closer to the reference.
    
    The other doesn't relate to that code path at all, and is already
    documented in types.BlobInfo.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    5e86eb8 View commit details
    Browse the repository at this point in the history
  2. Reformat TestSupported*MediaType

    Having each test case streched across four lines doesn't
    make it any more readable; seeing the test cases on the
    same screen as the test body is more valuable.
    
    Should not change (test) behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    ef4d0e2 View commit details
    Browse the repository at this point in the history
  3. Simplify repetitive code in manifest tests

    Add manifestSchema2FromFixture and manifestOCI1FromFixture
    instead of open-coding the read+decode steps over and over.
    
    The tests also fail immediately if they can't use the
    fixture, instead of somehow trying to continue (and probably
    crashing).
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    38b1d74 View commit details
    Browse the repository at this point in the history
  4. Move getEncryptedMediaType and getDecryptedMediaType closer to the on…

    …ly caller
    
    ... to make the code a tiny bit easier to follow.
    
    Only moves unchanged code, should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    bf597f6 View commit details
    Browse the repository at this point in the history
  5. Reject OCI artifacts in manifest.OCI1.ImageID

    ... and add tests for the ImageID implementations.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    83aee8f View commit details
    Browse the repository at this point in the history
  6. Reject OCI artifacts in manifest.OCI1.Inspect

    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    ec3d50b View commit details
    Browse the repository at this point in the history
  7. Refuse to convert non-image OCI artifacts to Docker formats

    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    e6e1a4f View commit details
    Browse the repository at this point in the history
  8. Reject OCI artifacts in image.manifestOCI1.OCIConfig

    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    d24d259 View commit details
    Browse the repository at this point in the history
  9. Pass imageCopier to copyBlobFromStream and blobPipelineCompressionStep

    This will allow us to refer to ic.c.cannotModifyManifestReason and
    image-specific properties; it just replaces the objects without
    changing the logic.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    2e6896f View commit details
    Browse the repository at this point in the history
  10. Move the canModifyBlob decision inside copyBlobFromStream

    ... to eliminate at least one of the many parameters.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    59bc35e View commit details
    Browse the repository at this point in the history
  11. Reorganize copyBlobFromStream a bit

    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    00e7d0f View commit details
    Browse the repository at this point in the history
  12. Add a srcInfo parameter to blobPipelineCompressionStep

    We will use it for debug logs.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    83034b5 View commit details
    Browse the repository at this point in the history
  13. Split findCompressionMIMETypeSet from compressionVariantMIMEType

    We will add another user of the lookup code.
    
    Erorr messages now use mimeType instead of mt, which were required
    required to be equal on that code path, now that mt is not visible.
    
    Should not change behavior.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    af70b53 View commit details
    Browse the repository at this point in the history
  14. Introduce SourcedImage.CanChangeLayerCompression, use it in copy.Image

    - Don't compress/decompress layers with unknown MIME types, and layers
      in OCI artifacts.
    - Don't even change manifest MIME types in these situations, whatever
      happens.
    - Don't substitute compressed/uncompressed variants (via
      TryReusingBlobWithOptions) for OCI artifacts, if we discover the
      same variants when copying images that refer to the same blobs.
    
    Note that this does _not_ restrict compression to algorithms supported
    by the SourcedImage, because that would prohibit a single-pass
    conversion from v2s2 to OCI while compressing to zstd [1], and that's
    a feature we currently exercise in tests. So, this prevents us from
    failing to copy OCI artifacts, but users of zstd still need to be careful
    about choosing OCI manually.
    
    [1] We would need to ask the _destination_ format handler about
    zstd, not the source-format SourcedImage, and we don't currently have
    that infrastructure. It's also not immediately clear how to combine
    this with the sequence of alternative manifest formats returned by
    determineManifestConversion.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Jun 16, 2022
    Configuration menu
    Copy the full SHA
    6d458ba View commit details
    Browse the repository at this point in the history