opencontainers / artifacts

OCI Artifacts
https://opencontainers.org
Apache License 2.0
224 stars 54 forks source link

How can you push 2 files with same ending and pull each one back? #52

Closed sturlath closed 2 years ago

sturlath commented 2 years ago

Lets say I have 2 files, up.sql and rollback.sql that I want to push to the registry so that in my devOps I can pull them down (and display in the release pipeline)

Push the first file

oras push demo.azurecr.io/demo-app:latest  --manifest-config NUL:application/vnd.unknown.config.v1+json .\up.sql:application/vnd.unknown.layer.v1+sql

then the second one

oras push demo.azurecr.io/demo-app:latest  --manifest-config NUL:application/vnd.unknown.config.v1+json .\rollback.sql:application/vnd.unknown.layer.v1+sql

And then when I pull I only get the last one I pushed (rollback.sql)

oras pull demo.azurecr.io/demo-app:latest  --media-type application/vnd.unknown.layer.v1+sql

I have tried various versions of these commands without success.

Anyone here that can point me to the thing I´m missing/misunderstanding?

sturlath commented 2 years ago

Ok I finally figured this out after reading Defining a Unique Artifact Type and Media Types (and various other scattered material)

oras push demo.azurecr.io/demo-app:latest --manifest-config NUL:application/mycorp.upmigration.config.v1+json .\up.sql:application/mycorp.upmigration.layer.v1+sql
oras push demo.azurecr.io/demo-app:latest --manifest-config NUL:application/mycorp.rollbackmigration.config.v1+json .\rollback.sql:application/mycorp.rollbackmigration.layer.v1+sql

And then I can pull them down with with these two separate ones

oras pull demo.azurecr.io/demo-app:latest --media-type application/mycorp.upmigration.layer.v1+sql

oras pull demo.azurecr.io/demo-app:latest --media-type application/mycorp.rollbackmigration.layer.v1+sql

Now I'll see if I can get this to work with CI/CD as I planned...