feat(tar driver): add OCI layout tar driver support#554
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds support for OCI layouts when using the Tar driver. It updates the CLI to accept the --image-from-oci-layout flag for both Docker and Tar drivers, introduces a new ImageFromV1 utility for filesystem extraction, and implements OCI layout handling within the TarDriver. Additionally, several architecture-specific test configurations and a new integration test case were included. Review feedback identifies a bug in a logrus.Fatalf call where a format argument is missing, suggests refactoring duplicated OCI layout logic into a shared utility, and points out a potential directory leak in ImageFromV1 if filesystem extraction fails.
Add support for OCI layout with tar driver: - Extend tar driver to handle OCI layout directories directly - Add OCILayout field to DriverConfig for tar driver configuration - Implement imageFromOCILayout function to load images from OCI layout - Add ImageFromV1 utility function to create Image from v1.Image - Update --image-from-oci-layout to support both Docker and Tar drivers Add test coverage: - Add Ubuntu 22.04 tar test configurations for amd64, arm64, ppc64le, and s390x architectures - Add test case for OCI layout with tar driver in test script Closes GoogleContainerTools#461
f42988b to
23e375c
Compare
|
@loosebazooka could you TAL when you get a few minutes? 🙏🏻 |
|
Is there a status update here? IIUC, this would allow using |
|
This repo is sort of in best effort state. The two tagged users are no longer working on it. I can try to get to it but it's lower priority |
…#503) Adapts upstream PR GoogleContainerTools#503 ("Add support for multi-arch image indexes") to the fork. Upstream placed the index-selection logic inline in test.go, but the fork's GoogleContainerTools#554 since centralized OCI-layout loading into pkgutil.ImageFromOCILayout (shared by the Docker daemon path and the Tar driver). The platform-based selection is added there instead, so both drivers gain multi-arch support. ImageFromOCILayout now takes a platform string; callers pass opts.Platform / args.Platform. Two fork-authored changes beyond the upstream diff: - Nil-platform guard: v1.Descriptor.Platform is a nil-able *v1.Platform (OCI permits an index descriptor with no platform), and Satisfies has a value receiver, so the upstream desc.Platform.Satisfies(...) call panics with a nil dereference on such descriptors. findImageInIndex now skips any descriptor whose Platform is nil. Covered by a unit test that panics without the guard and passes with it. - parsePlatform replaced with go-containerregistry's v1.ParsePlatform, which accepts variants (e.g. linux/arm/v7) that the hand-rolled parser rejected. Also fixes the bundled shell test: numeric comparison uses -lt instead of the string operator <, and the multi-arch temp dir no longer clobbers the $tmp used by the following tar-driver test. Co-authored-by: Joel Sing <jsing@canva.com> Upstream-PR: GoogleContainerTools#503
Add support for OCI layout with tar driver:
Add test coverage:
Closes #461