-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle rebasing images with empty layers properly
Manifest v2 specs do not include layer entries for empty layers, but the history in the config will include an entry for empty layers (e.g. produced by `ENV` directive). History entries for empty layers include `empty_layer` field set to `true`. As a result, when rebasing and copying from the new base and original to the rebased image, it's not sufficient to simply iterate layers and pull from the same position/index in the history from config. Instead, history should be iterated and used to generate `Addendum`, while simultaneously iterating layers, but only including the layer (and advancing the iterator) if it's for a history item for a non-empty layer. Since the history in config is optional per the OCI spec [1], iteration via layers will still happen in the event that not all layers are consumed during the history pass. (This should also guard against a malformed history). [1]: https://github.com/opencontainers/image-spec/blob/master/config.md
- Loading branch information
Showing
2 changed files
with
59 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters