Skip to content

feat(tar driver): add OCI layout tar driver support#554

Open
malt3 wants to merge 1 commit into
GoogleContainerTools:mainfrom
malt3:publish-tar_driver_support_oci_layout
Open

feat(tar driver): add OCI layout tar driver support#554
malt3 wants to merge 1 commit into
GoogleContainerTools:mainfrom
malt3:publish-tar_driver_support_oci_layout

Conversation

@malt3

@malt3 malt3 commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

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 #461

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/container-structure-test/app/cmd/test.go
Comment thread pkg/drivers/tar_driver.go
Comment thread internal/pkgutil/image_utils.go
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
@malt3 malt3 force-pushed the publish-tar_driver_support_oci_layout branch from f42988b to 23e375c Compare April 13, 2026 14:44
@alexeagle

Copy link
Copy Markdown
Collaborator

@loosebazooka could you TAL when you get a few minutes? 🙏🏻

@faximan

faximan commented Jun 2, 2026

Copy link
Copy Markdown

Is there a status update here? IIUC, this would allow using container_structure_test to test an oci_image without having to build the full .tar (which is very expensive for big images)

@tstromberg @nkubala

@loosebazooka

Copy link
Copy Markdown
Member

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

thomasdesr added a commit to anyscale/container-structure-test that referenced this pull request Jun 29, 2026
…#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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bazel: support tar driver for oci_image

4 participants