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

Copy: Support MIME type changes, two-step updates #1147

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Commits on Aug 25, 2021

  1. Beautify

    - Remove a nonsensical comment
    - Remove a redundant variable
    - Move one line closer to its user.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    6100006 View commit details
    Browse the repository at this point in the history
  2. Implement LayerInfosForCopy changing MIME types

    Currently, horribly, types.UpdatedImage is _documented_ to ignore
    ManifestUpdateOptions.LayerInfos.MediaType; so if LayerInfosForCopy
    replaces a layer with a differently-compressed one, that MIME type
    update is never performed.
    
    First, work around that by adding updatedImageWithMIME as a
    hopefully temporary hack that implements the edit using CompressionOperation
    + CompressionAlgorithm (which are not documented to be ignored).
    
    Then, use it to process LayerInfosForCopy.  Because LayerInfosForCopy's
    MediaType values are manifest-schema specific, we must call UpdatedImage(WithMime)
    twice: once just to update the layers with LayerInfosForCopy information
    using the original schema, and later to possibly convert the manifest and apply
    CompressionOperation/... from results of TryReusingBlob/PutBlob.  So,
    move the LayerInfosForCopy processing before determineManifestConversion
    requests a MIME type change.
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    d31efef View commit details
    Browse the repository at this point in the history
  3. Optimize useLayerInfosForCopy a bit

    Only call ic.src.LayerInfos() if necessary to
    evaluate UpdatedLayerInfosForCopy().
    
    Signed-off-by: Miloslav Trmač <mitr@redhat.com>
    mtrmac committed Aug 25, 2021
    Configuration menu
    Copy the full SHA
    8040d74 View commit details
    Browse the repository at this point in the history