Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Oras does not read re-archived docker TAR files correctly #851

Open
Atharex opened this issue Nov 27, 2024 · 4 comments
Open

Oras does not read re-archived docker TAR files correctly #851

Atharex opened this issue Nov 27, 2024 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@Atharex
Copy link

Atharex commented Nov 27, 2024

Details & original discussion thread here:
oras-project/oras#1539

@Atharex Atharex changed the title Oras does not read re-archive docker TAR files correctly Oras does not read re-archived docker TAR files correctly Nov 27, 2024
@Wwwsylvia
Copy link
Member

Wwwsylvia commented Nov 28, 2024

The read-only OCI store fails to read the OCI layout structure in the tar archive with paths like this:

./
./ingest/
./oci-layout
./blobs/
./manifest.json
./index.json
./blobs/sha256/
./blobs/sha256/47e549d92058c6be6788e0a58015139799b80f4dfce7f15b652fc1e1e9173f3c
./blobs/sha256/aea846b98069d2b6e8f724516dc240bb64d8c1442bff11a4214285b332752e17
./blobs/sha256/e8a12bb7d8bb7ed656f75d7704f0e71fa87ecacce976771b5ec3e2c33f0af4ef
./blobs/sha256/b330ae2d2adaa388d4550a8eefd9c2ed0408e71fbe88d1024923c07e4d159534
./blobs/sha256/8bdfa8f36fb2a96b290e2a9d34417d0d75bb336dda841b02fcfe7c71ed8e82ac
./blobs/sha256/6c0706c7fd54fc41b413f8afc8fc0a16ef3533304662d8c76dde77550daa6ce5
./blobs/sha256/2641af8aae2ffd04482f279a21b42efb998d9b3749f148a8702ae0fa3cc8ebe9
./blobs/sha256/44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a
./blobs/sha256/1bd70f80990f7476d7e49358341e36e75e1d35e1c086aea137066b0a8ffaabdb
./blobs/sha256/4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
./blobs/sha256/63e80638f63862663c24c5add6bc2061c36630999dd82ed1dd6930eefb40321b
./blobs/sha256/b10317b39372a42769eae7f844cfb40847472f5ebc6512949ef79d4ed4b2ce5f
./blobs/sha256/3c9a20db4bdb148f9288d39bd7f5a77e74a0215d80657414da618c1cecabffde
./blobs/sha256/6c371231fb54e10d0664c39c6987da28b54ca0ae4d4b24ca5b2c39cd66d4f5d9
./blobs/sha256/6bffa3eeff0dabf4d524b76ff2a40e5fe81288e433e0fa1282d9ab6b3e1400fd
./blobs/sha256/7e3b87ef0305b2734e28a5167505d67ee07ef7e9abd9b2a22a3af587a87047e0

Currently it can only recognize path like this:

blobs/
blobs/sha256/
blobs/sha256/1bd70f80990f7476d7e49358341e36e75e1d35e1c086aea137066b0a8ffaabdb
blobs/sha256/2641af8aae2ffd04482f279a21b42efb998d9b3749f148a8702ae0fa3cc8ebe9
blobs/sha256/3c9a20db4bdb148f9288d39bd7f5a77e74a0215d80657414da618c1cecabffde
blobs/sha256/47e549d92058c6be6788e0a58015139799b80f4dfce7f15b652fc1e1e9173f3c
blobs/sha256/4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
blobs/sha256/63e80638f63862663c24c5add6bc2061c36630999dd82ed1dd6930eefb40321b
blobs/sha256/6c0706c7fd54fc41b413f8afc8fc0a16ef3533304662d8c76dde77550daa6ce5
blobs/sha256/7e3b87ef0305b2734e28a5167505d67ee07ef7e9abd9b2a22a3af587a87047e0
blobs/sha256/8bdfa8f36fb2a96b290e2a9d34417d0d75bb336dda841b02fcfe7c71ed8e82ac
blobs/sha256/aea846b98069d2b6e8f724516dc240bb64d8c1442bff11a4214285b332752e17
blobs/sha256/b10317b39372a42769eae7f844cfb40847472f5ebc6512949ef79d4ed4b2ce5f
blobs/sha256/b330ae2d2adaa388d4550a8eefd9c2ed0408e71fbe88d1024923c07e4d159534
blobs/sha256/e8a12bb7d8bb7ed656f75d7704f0e71fa87ecacce976771b5ec3e2c33f0af4ef
index.json
manifest.json
oci-layout

We should improve the implementation of tarfs.

@Wwwsylvia
Copy link
Member

Hi @Atharex, before we implement the enhancement, can you try the following tar command as a workaround?

Suppose you have a local OCI layout directory repo that is extracted from repo.tar. After making some changes on the directory repo, you can archive it back by running:

cd repo && rm -r ingest/ && tar cvf ../repo_modified.tar * && cd ..

@Wwwsylvia Wwwsylvia added the enhancement New feature or request label Dec 3, 2024
@Atharex
Copy link
Author

Atharex commented Dec 3, 2024

Hi @Wwwsylvia, this workaround actually works!

After running tar within the folder, the archive is properly packaged and can be read with oras as normal

$ oras discover --oci-layout modified_local.tar:$TAG 
modified_local.tar@sha256:7e3b87ef0305b2734e28a5167505d67ee07ef7e9abd9b2a22a3af587a87047e0
└── my-favorite-artifact/type
    └── sha256:44a365ff03ad9dce2ae7898556446bd2e0708ab11bc68ec7b3ed08507bb9fb94

@Wwwsylvia
Copy link
Member

Wwwsylvia commented Dec 3, 2024

@Atharex Sounds good! Currently we have to package paths without the ./ prefix. The way to produce such tar files is a bit tricky though. 🫤
We will improve this in a future release! Thanks for opening the issue.

@Wwwsylvia Wwwsylvia added this to the v2.6.0 milestone Dec 30, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants