Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Oras attach with plateform weird behavior when using oras cp #812

Closed
1 task
SamirPS opened this issue Feb 14, 2023 · 27 comments · Fixed by #818
Closed
1 task

Oras attach with plateform weird behavior when using oras cp #812

SamirPS opened this issue Feb 14, 2023 · 27 comments · Fixed by #818
Assignees
Labels
bug Something isn't working
Milestone

Comments

@SamirPS
Copy link
Contributor

SamirPS commented Feb 14, 2023

What happened in your environment?

I have done this:

oras cp ghcr.io/oras-project/oras:v1.0.0-rc.1 --to-oci-layout ./local/oras:v1.0.0-rc.1 -v
oras attach --debug --oci-layout --artifact-type test.sbom ./local/oras@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117 sbom 
oras discover --oci-layout ./local/oras:v1.0.0-rc.1 -v -o tree --platform linux/s390x

the output is

v1.0.0-rc.1
└── test.sbom
    └── sha256:f5a5798d17e52a0cf5094b835c45e87a138b1e041d945882b7ae396c0b8bda48
        └── org.opencontainers.artifact.created: "2023-02-14T10:22:14Z"

After that, I want to copy this to an azure repository with the following:

oras cp -r --debug --from-oci-layout -v ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:testfororas

output:

DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000] > Request method: "HEAD"                     
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" 
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "401 Unauthorized"        
DEBU[0000] < Response headers:                          
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "X-Ms-Correlation-Request-Id": "ab852b21-cc32-4f64-9716-f3529afb081a" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "Www-Authenticate": "Bearer realm=\"https://xxx.azurecr.io/oauth2/token\",service=\"xxx.azurecr.io\",scope=\"repository:artifactstest:pull\"" 
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0000]    "Content-Length": "207"                   
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Server": "openresty"                     
DEBU[0000] > Request URL: "https://xxx.azurecr.io/oauth2/token?scope=repository%3Aartifactstest%3Apull&service=xxx.azurecr.io" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "X-Ms-Ratelimit-Remaining-Calls-Per-Second": "166.65" 
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "X-Ms-Correlation-Request-Id": "432cc6a8-9de1-4de6-a32c-db116afe19c2" 
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000] > Request method: "HEAD"                     
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" 
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "X-Ms-Client-Request-Id": ""              
DEBU[0000]    "X-Ms-Request-Id": "eeb4e549-d1a2-45ef-b92f-9c230ebb645e" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json" 
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Docker-Content-Digest": "sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000]    "Etag": "\"sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b\"" 
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Content-Length": "3138"                  
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "X-Ms-Correlation-Request-Id": "53bee9d4-6c62-4e6c-961a-092460a450eb" 
Exists  4169ef297659 application/vnd.oci.image.index.v1+json
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.oci.image.index.v1+json" 
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "401 Unauthorized"        
DEBU[0000] < Response headers:                          
DEBU[0000]    "Content-Length": "207"                   
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Www-Authenticate": "Bearer realm=\"https://xxx.azurecr.io/oauth2/token\",service=\"xxx.azurecr.io\",scope=\"repository:artifactstest:pull\"" 
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "X-Ms-Correlation-Request-Id": "5b82009f-eebc-4022-b4ab-980cfcd2269b" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/oauth2/token?scope=repository%3Aartifactstest%3Apull%2Cpush&service=xxx.azurecr.io" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains" 
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "X-Ms-Correlation-Request-Id": "ba574568-f2d0-4c1e-b074-6b65a72b39d8" 
DEBU[0000]    "X-Ms-Ratelimit-Remaining-Calls-Per-Second": "166.65" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.oci.image.index.v1+json" 
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Etag": "\"sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b\"" 
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Docker-Content-Digest": "sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000]    "X-Ms-Correlation-Request-Id": "3236f1f8-061e-433a-896f-3b68cb2859b6" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0000]    "Content-Length": "3138"                  
DEBU[0000]    "X-Ms-Client-Request-Id": ""              
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "X-Ms-Request-Id": "bc80b544-42f1-47d9-b3fd-88e32c30fcd6" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/testfororas5" 
DEBU[0000] > Request method: "PUT"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json" 
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0001] < Response Status: "201 Created"             
DEBU[0001] < Response headers:                          
DEBU[0001]    "Docker-Content-Digest": "sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0001]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0001]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0001]    "X-Content-Type-Options": "nosniff"       
DEBU[0001]    "Date": "Tue, 14 Feb 2023 10:23:52 GMT"   
DEBU[0001]    "Location": "/v2/artifactstest/manifests/sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0001]    "X-Ms-Client-Request-Id": ""              
DEBU[0001]    "X-Ms-Correlation-Request-Id": "026416ab-8329-4186-a1a3-c0c97e20ef8d" 
DEBU[0001]    "X-Ms-Request-Id": "f25d0678-31f5-4e8a-83eb-8ba6302252a0" 
DEBU[0001]    "Server": "openresty"                     
DEBU[0001]    "Content-Length": "0"                     
DEBU[0001]    "Connection": "keep-alive"                
DEBU[0001]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] xxx.azurecr.io/artifactstest:testfororas5
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

But now if I do

oras discover --debug xxx.azurecr.io/artifactstest:testfororas5 --platform linux/s390x

I have this:

DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/testfororas5" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" 
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "401 Unauthorized"        
DEBU[0000] < Response headers:                          
DEBU[0000]    "Content-Length": "207"                   
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "Www-Authenticate": "Bearer realm=\"https://xxx.azurecr.io/oauth2/token\",service=\"xxx.azurecr.io\",scope=\"repository:artifactstest:pull\"" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:26:01 GMT"   
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "X-Ms-Correlation-Request-Id": "500f9976-b72a-47be-8de3-9b79f5e5afe5" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/oauth2/token?scope=repository%3Aartifactstest%3Apull&service=xxx.azurecr.io" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "X-Ms-Ratelimit-Remaining-Calls-Per-Second": "166.65" 
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:26:01 GMT"   
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "X-Ms-Correlation-Request-Id": "c481e3b5-28b7-4dbf-ae75-9f0faac8dbfb" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/testfororas5" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000]    "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:26:01 GMT"   
DEBU[0000]    "X-Ms-Request-Id": "d5cc536c-5acf-4db8-bf13-780ed6d445ea" 
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Docker-Content-Digest": "sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000]    "Etag": "\"sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b\"" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Content-Length": "3138"                  
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "X-Ms-Client-Request-Id": ""              
DEBU[0000]    "X-Ms-Correlation-Request-Id": "92bc2f8a-e9d3-42c2-9fa8-fb36837f375f" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/referrers/sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "X-Ms-Correlation-Request-Id": "e6790bbc-38ce-4e94-86ca-2773bc9f1dd7" 
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:26:01 GMT"   
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json; charset=utf-8" 
DEBU[0000]    "Content-Length": "89"                    
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
Discovered 0 artifact referencing testfororas5
Digest: sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117

But if I do

oras discover --debug xxx.azurecr.io/artifactstest:testfororas5
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/testfororas5" 
DEBU[0000] > Request method: "HEAD"                     
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" 
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "401 Unauthorized"        
DEBU[0000] < Response headers:                          
DEBU[0000]    "Content-Length": "207"                   
DEBU[0000]    "X-Ms-Correlation-Request-Id": "deb34173-c307-4269-b59a-4a942d2bd3b5" 
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Www-Authenticate": "Bearer realm=\"https://xxx.azurecr.io/oauth2/token\",service=\"xxx.azurecr.io\",scope=\"repository:artifactstest:pull\"" 
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:27:25 GMT"   
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/oauth2/token?scope=repository%3Aartifactstest%3Apull&service=xxx.azurecr.io" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:27:25 GMT"   
DEBU[0000]    "Content-Type": "application/json; charset=utf-8" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "X-Ms-Correlation-Request-Id": "e6238594-988e-4f9a-b2d3-97478e1d4ed4" 
DEBU[0000]    "X-Ms-Ratelimit-Remaining-Calls-Per-Second": "166.65" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains" 
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/manifests/testfororas5" 
DEBU[0000] > Request method: "HEAD"                     
DEBU[0000] > Request headers:                           
DEBU[0000]    "Accept": "application/vnd.docker.distribution.manifest.v2+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.oci.image.index.v1+json, application/vnd.oci.artifact.manifest.v1+json" 
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "X-Ms-Client-Request-Id": ""              
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json" 
DEBU[0000]    "Content-Length": "3138"                  
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "X-Ms-Correlation-Request-Id": "4446a9a2-adf7-48eb-bac9-49e05e4d9e20" 
DEBU[0000]    "X-Ms-Request-Id": "30574f2a-e5fd-489d-b22c-3628a2d6f997" 
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:27:26 GMT"   
DEBU[0000]    "Docker-Content-Digest": "sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Etag": "\"sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b\"" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000] > Request URL: "https://xxx.azurecr.io/v2/artifactstest/referrers/sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b" 
DEBU[0000] > Request method: "GET"                      
DEBU[0000] > Request headers:                           
DEBU[0000]    "Authorization": "*****"                  
DEBU[0000]    "User-Agent": "oras/1.0.0-rc.1+unreleased" 
DEBU[0000] < Response Status: "200 OK"                  
DEBU[0000] < Response headers:                          
DEBU[0000]    "Content-Type": "application/vnd.oci.image.index.v1+json; charset=utf-8" 
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Access-Control-Expose-Headers": "Docker-Content-Digest, WWW-Authenticate, Link, X-Ms-Correlation-Request-Id" 
DEBU[0000]    "Strict-Transport-Security": "max-age=31536000; includeSubDomains, max-age=31536000; includeSubDomains" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "X-Ms-Correlation-Request-Id": "c62cbacd-9b37-46ec-b8a7-531db5992eb3" 
DEBU[0000]    "Date": "Tue, 14 Feb 2023 10:27:26 GMT"   
DEBU[0000]    "Connection": "keep-alive"                
DEBU[0000]    "Server": "openresty"                     
DEBU[0000]    "Content-Length": "632"                   
Discovered 2 artifacts referencing testfororas5
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

Artifact Type           Digest
application/spdx+sbom   sha256:d9cf57f84c4f1fcb51e939915f100c14fee8c60111e1d0d2ea5d160d9a8b42f7
application/spdx+json   sha256:4fe1c210244e0c27524ef9b8d28463cb8d5d093a30615ecaf4c7d1c6a92e2908

So right now I don't know on what these two artifacts are related and it's weird that no artifact is related to the linux/s390x platform

What did you expect to happen?

Normally when I don't use the platform flag I will have no discovered artefact. But with the platform flag, I need to have 1 artefact named sbom.

How can we reproduce it?

Ubuntu jammy and theses commands:

oras cp ghcr.io/oras-project/oras:v1.0.0-rc.1 --to-oci-layout ./local/oras:v1.0.0-rc.1 -v
oras attach --debug --oci-layout --artifact-type test.sbom ./local/oras@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117 sbom 
oras discover --oci-layout ./local/oras:v1.0.0-rc.1 -v -o tree --platform linux/s390x
oras cp -r --debug --from-oci-layout -v ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:testfororas
oras discover --debug xxx.azurecr.io/artifactstest:testfororas5 --platform linux/s390x
oras discover --debug xxx.azurecr.io/artifactstest:testfororas5

What is the version of your ORAS CLI?

Version: 1.0.0-rc.1+unreleased
Go version: go1.20
Git commit: 8bda262
Git tree state: clean

What is your OS environment?

Ubuntu jammy

Are you willing to submit PRs to fix it?

  • Yes, I am willing to fix it.
@SamirPS SamirPS added the bug Something isn't working label Feb 14, 2023
@qweeah
Copy link
Contributor

qweeah commented Feb 14, 2023

  1. Why the index(manifest list) have unexpected referrers?
    There are some mismatches in the log and command, e.g. you recursively copied to xxx.azurecr.io/artifactstest:testfororas but you are discovering xxx.azurecr.io/artifactstest:testfororas5? Can you help delete local directory and remote repository(it's doable via Azure portal) and rerun the command to reconfirm?

  2. Why the referrer of x390s(sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117) is not copied?
    It's expected. Since you do a recursive copy(oras cp -r) based on the index, upward copying only covers index's referrer. Extend copy won't cover its child node's referrer.

@qweeah
Copy link
Contributor

qweeah commented Feb 14, 2023

In the below graph:

  • copy -r on index: every node will be copied, except B
  • copy -r on linux/s390x: every node will be copied
graph TD
A --> index
index --> linux/amd64
index --> linux/arm64
index --> linux/s390x
B --> linux/s390x
Loading

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 14, 2023

  1. Why the index(manifest list) have unexpected referrers?
    There are some mismatches in the log and command, e.g. you recursively copied to xxx.azurecr.io/artifactstest:testfororas but you are discovering xxx.azurecr.io/artifactstest:testfororas5? Can you help delete local directory and remote repository(it's doable via Azure portal) and rerun the command to reconfirm?

Sorry it's a typo error the cp -r has been done to xxx.azurecr.io/artifactstest:testfororas5

I have redo the step:

oras discover --oci-layout ./local/oras:v1.0.0-rc.1 -v -o tree --platform linux/s390x
v1.0.0-rc.1
└── test.sbom
    └── sha256:a82f75688e55e45d826051bb3402a23068676d09650042400da0ce66558c7ef5
        └── org.opencontainers.artifact.created: "2023-02-14T14:03:52Z"
oras cp -r --platform linux/s390x --from-oci-layout -v ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:testfororas5
Exists  4169ef297659 application/vnd.oci.image.index.v1+json
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] xxx.azurecr.io/artifactstest:testfororas5
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b
samir@samir-Laptop:~/Desktop/test/testarches$ oras discover xxx.azurecr.io/artifactstest:testfororas5 --platform linux/s390x
Discovered 0 artifact referencing testfororas5
Digest: sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117
samir@samir-Laptop:~/Desktop/test/testarches$ oras discover xxx.azurecr.io/artifactstest:testfororas5
Discovered 0 artifact referencing testfororas5
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

And if i use the cp -r

oras cp -r --from-oci-layout -v ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:testcp
Exists  4169ef297659 application/vnd.oci.image.index.v1+json
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] xxx.azurecr.io/artifactstest:testcp
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b
samir@samir-Laptop:~/Desktop/test/testarches$ oras discover xxx.azurecr.io/artifactstest:testcp
Discovered 0 artifact referencing testcp
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b
samir@samir-Laptop:~/Desktop/test/testarches$ oras discover xxx.azurecr.io/artifactstest:testcp --platform linux/s390x
Discovered 0 artifact referencing testcp
Digest: sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117

I use the wrong oras cp command, or did I not understand something?

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 14, 2023

Or i don't need to use the platform flag but only the digest of the Linux/s390x ?

@qweeah
Copy link
Contributor

qweeah commented Feb 14, 2023

Or i don't need to use the platform flag but only the digest of the Linux/s390x ?

sorry I don't get it, do you mean when copying?

@qweeah
Copy link
Contributor

qweeah commented Feb 14, 2023

oras cp -r --from-oci-layout -v ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:testcp
Exists 4169ef297659 application/vnd.oci.image.index.v1+json
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] xxx.azurecr.io/artifactstest:testcp
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

I cannot reproduce this, if ./local/oras:v1.0.0-rc.1 have referrers in the local OCI layout, the copying log must contain its referrer, are you sure that -r is used when copying the index?

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 14, 2023

Yeah i'm sure that the -r is used

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 14, 2023

Or i don't need to use the platform flag but only the digest of the Linux/s390x ?

sorry I don't get it, do you mean when copying?

yes

@qweeah
Copy link
Contributor

qweeah commented Feb 14, 2023

Yeah i'm sure that the -r is used

I cannot reproduce the issue, I can copy the index(4169ef297659) and its referrers(f28da388ea96) even when the index is already in the registry.

$ oras cp -v --from-oci-layout ./local/oras:v1.0.0-rc.1 jinzha1.azurecr.io/debug/unexpected-referrer:v1 -r
Copying 89813b6c4aaa sbom
Exists  4169ef297659 application/vnd.oci.image.index.v1+json
Copied  89813b6c4aaa sbom
Copying f28da388ea96 application/vnd.oci.artifact.manifest.v1+json
Copied  f28da388ea96 application/vnd.oci.artifact.manifest.v1+json
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] jinzha1.azurecr.io/debug/unexpected-referrer:v1
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

Can you double check again? In below log, if both the index(4169ef297659) and its referrers(f28da388ea96) are both existent in the registry, the log should show the existence of the up-most node, which is the referrer (in your log, Exists 4169ef297659 application/vnd.oci.image.index.v1+json shows the existence of the index).

oras cp -v --from-oci-layout ./local/oras:v1.0.0-rc.1 jinzha1.azurecr.io/debug/unexpected-referrer:v1 -r
Exists  f28da388ea96 application/vnd.oci.artifact.manifest.v1+json
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] jinzha1.azurecr.io/debug/unexpected-referrer:v1
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 14, 2023

I have recreated the repository and have done this:

oras attach -v --debug --oci-layout --artifact-type "application/spdx+json" ./local/oras@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117 sbom 
Preparing sbom
Uploading 89813b6c4aaa sbom
Uploaded  89813b6c4aaa sbom
Uploading 31669797e528 application/vnd.oci.artifact.manifest.v1+json
Uploaded  31669797e528 application/vnd.oci.artifact.manifest.v1+json
Attached to [oci-layout] ./local/oras@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117
Digest: sha256:31669797e528ab60d114b112cc72031e8b33a2d62ab63bebc1830c4e662f032c

and this

oras cp -v --from-oci-layout ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:v1 -r
Copying 4c8f27c7ace7 application/vnd.oci.image.config.v1+json
Copying 2b932b5ae7c5 application/vnd.oci.image.config.v1+json
Copying c527615e4ffa application/vnd.oci.image.layer.v1.tar+gzip
Copied  4c8f27c7ace7 application/vnd.oci.image.config.v1+json
Copied  2b932b5ae7c5 application/vnd.oci.image.config.v1+json
Copying 9b1b3e84cfce application/vnd.oci.image.config.v1+json
Copying 7207771c0983 application/vnd.oci.image.config.v1+json
Copied  9b1b3e84cfce application/vnd.oci.image.config.v1+json
Copying a9eaa45ef418 application/vnd.oci.image.layer.v1.tar+gzip
Copied  7207771c0983 application/vnd.oci.image.config.v1+json
Copying 10141d6f60e3 application/vnd.oci.image.config.v1+json
Copied  c527615e4ffa application/vnd.oci.image.layer.v1.tar+gzip
Copying 6c1f0c64c982 application/vnd.oci.image.layer.v1.tar+gzip
Copied  10141d6f60e3 application/vnd.oci.image.config.v1+json
Copying 8921db27df28 application/vnd.oci.image.layer.v1.tar+gzip
Copied  a9eaa45ef418 application/vnd.oci.image.layer.v1.tar+gzip
Copying 4405ccf2ea29 application/vnd.oci.image.config.v1+json
Copied  6c1f0c64c982 application/vnd.oci.image.layer.v1.tar+gzip
Copying ae982806674c application/vnd.oci.image.layer.v1.tar+gzip
Copied  4405ccf2ea29 application/vnd.oci.image.config.v1+json
Copying 6c2912f09703 application/vnd.oci.image.layer.v1.tar+gzip
Copied  ae982806674c application/vnd.oci.image.layer.v1.tar+gzip
Copying 4e28d44660b5 application/vnd.in-toto+json
Copied  6c2912f09703 application/vnd.oci.image.layer.v1.tar+gzip
Copied  8921db27df28 application/vnd.oci.image.layer.v1.tar+gzip
Copying 94d10b30a6fa application/vnd.oci.image.layer.v1.tar+gzip
Copying 1a11ab8b1d43 application/vnd.oci.image.layer.v1.tar+gzip
Copied  4e28d44660b5 application/vnd.in-toto+json
Copying f5ce68f0d1c2 application/vnd.oci.image.config.v1+json
Copied  f5ce68f0d1c2 application/vnd.oci.image.config.v1+json
Copying ccc2c6909199 application/vnd.in-toto+json
Copied  94d10b30a6fa application/vnd.oci.image.layer.v1.tar+gzip
Copying ebe6da8da807 application/vnd.oci.image.layer.v1.tar+gzip
Copied  1a11ab8b1d43 application/vnd.oci.image.layer.v1.tar+gzip
Copied  ccc2c6909199 application/vnd.in-toto+json
Copying a13c15bd0189 application/vnd.oci.image.layer.v1.tar+gzip
Copying b2b3744be822 application/vnd.oci.image.layer.v1.tar+gzip
Copied  b2b3744be822 application/vnd.oci.image.layer.v1.tar+gzip
Copied  ebe6da8da807 application/vnd.oci.image.layer.v1.tar+gzip
Copying 3a8de8c4b510 application/vnd.oci.image.manifest.v1+json
Copying a75d85393884 application/vnd.oci.image.layer.v1.tar+gzip
Copied  a13c15bd0189 application/vnd.oci.image.layer.v1.tar+gzip
Copied  3a8de8c4b510 application/vnd.oci.image.manifest.v1+json
Copying 1004ddc3b148 application/vnd.oci.image.config.v1+json
Copying 2deb4fb8b987 application/vnd.in-toto+json
Copied  2deb4fb8b987 application/vnd.in-toto+json
Copied  1004ddc3b148 application/vnd.oci.image.config.v1+json
Copying dcfb8b20ccbc application/vnd.oci.image.layer.v1.tar+gzip
Copying a8f859c85eed application/vnd.oci.image.layer.v1.tar+gzip
Copied  a75d85393884 application/vnd.oci.image.layer.v1.tar+gzip
Copying ff38be3e7200 application/vnd.oci.image.manifest.v1+json
Copied  a8f859c85eed application/vnd.oci.image.layer.v1.tar+gzip
Copied  ff38be3e7200 application/vnd.oci.image.manifest.v1+json
Copying 4f4fb700ef54 application/vnd.oci.image.layer.v1.tar+gzip
Copying c4ce2a7a878e application/vnd.oci.image.layer.v1.tar+gzip
Copied  4f4fb700ef54 application/vnd.oci.image.layer.v1.tar+gzip
Copied  dcfb8b20ccbc application/vnd.oci.image.layer.v1.tar+gzip
Copying cc1e83bb63af application/vnd.oci.image.manifest.v1+json
Copied  c4ce2a7a878e application/vnd.oci.image.layer.v1.tar+gzip
Copying 63aa323be091 application/vnd.in-toto+json
Copying 7477317364b0 application/vnd.oci.image.layer.v1.tar+gzip
Copied  cc1e83bb63af application/vnd.oci.image.manifest.v1+json
Copying 604988e3bccd application/vnd.oci.image.manifest.v1+json
Copied  7477317364b0 application/vnd.oci.image.layer.v1.tar+gzip
Copying 7033448ea81b application/vnd.oci.image.manifest.v1+json
Copied  63aa323be091 application/vnd.in-toto+json
Copying c600938ccbd2 application/vnd.oci.image.manifest.v1+json
Copied  604988e3bccd application/vnd.oci.image.manifest.v1+json
Copying d1903141acef application/vnd.oci.image.manifest.v1+json
Copied  7033448ea81b application/vnd.oci.image.manifest.v1+json
Copying 872c0624fd6f application/vnd.oci.image.manifest.v1+json
Copied  c600938ccbd2 application/vnd.oci.image.manifest.v1+json
Copied  872c0624fd6f application/vnd.oci.image.manifest.v1+json
Copied  d1903141acef application/vnd.oci.image.manifest.v1+json
Copying 4169ef297659 application/vnd.oci.image.index.v1+json
Copied  4169ef297659 application/vnd.oci.image.index.v1+json
Copied [oci-layout] ./local/oras:v1.0.0-rc.1 => [registry] xxx.azurecr.io/artifactstest:v1
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b

Then if I check the discover:

oras discover xxx.azurecr.io/artifactstest:v1
Discovered 0 artifact referencing v1
Digest: sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b
oras discover xxx.azurecr.io/artifactstest:v1 --platform linux/s390x
Discovered 0 artifact referencing v1
Digest: sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117
oras discover xxx.azurecr.io/artifactstest:v1@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117
Discovered 0 artifact referencing sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117
Digest: sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117

@qweeah
Copy link
Contributor

qweeah commented Feb 14, 2023

This is expected behavior.

What you have done is recursively copying from the index node, you can try below command to copy from linux/s390x. Its referrer artifact sha256:31669797 will also be copied.

oras cp -v --from-oci-layout ./local/oras:v1.0.0-rc.1 xxx.azurecr.io/artifactstest:v1 -r --platform linux/s390x

graph TD
index --> linux/amd64
index --> linux/arm64
index --> linux/s390x
sha256:31669797 --> linux/s390x
Loading
  • sha256:31669797 will not be included if you recursively copying from index, since upward searching only happens on the root, which is index.
  • sha256:31669797 will be included if you recursively copying from linux/s390x, since upward searching now starts from linux/s390x.

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

Double checked, this is indeed a bug, summarizing it:

  • If recursive copying (--recursive) and arch switching (--platform) flags are used at the same, and the to-be-copied reference points to an index, then referrers of the index will be copied. Expected behavior is that referrers of the chosen arch image are copied.

@qweeah qweeah added this to the v1.0.0-rc.2 milestone Feb 15, 2023
@qweeah qweeah self-assigned this Feb 15, 2023
@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

@SamirPS Before we fix this issue, there is a workaround: if you need to recursively copying a certain-arch image, PLEASE don't specify the image via --platform, use the image manifest digest instead. You may obtain the digest from the multi-arch index manifest via oras manifest fetch.

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 15, 2023

@qweeah Okay, I do this

oras cp -r --debug --from-oci-layout -v ./local/oras@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117 xxx.azurecr.io/artifactstest:v1

Only the linux/s390x image and the artefacts it's copied, but how to copy also at the same time the image for the other arches like am64? Do I need to redo copy with the digest?

Would you happen to have some examples of commands?

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

Only the linux/s390x image and the artefacts it's copied, but how to copy also at the same time the image for the other arches like am64?

Other arches are also copied, try below command to validate:

oras manifest fetch --platform linux/amd64 xxx.azurecr.io/artifactstest@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117 # get manifest for linux/amd64
oras manifest fetch --platform linux/arm64 xxx.azurecr.io/artifactstest@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117  # get manifest for linux/arm64

The digest sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117 is the digest of the multi-arch manifest(index, manifest). It's tagged as v1.0.0-rc.1 but doesn't have a tag in the destination registry.

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 15, 2023

The first command :

Error: failed to fetch the content of "xxx.azurecr.io/artifactstest@sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117": sha256:d1903141acefdeed52e34811d495f7569aba7b97d69c5a7ad22a3f213679b117: not found: platform in manifest does not match target platform

The second: same error. But how do I give them the v1 tag in the destination registry? Like what I want at the end in xxx.azurecr.io/artifactstest:v1 it's an multi-arch manifest with an oci artifact attached to linux/s390x

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

You can only tag x390s as v1 since you are copying recursively from x390s

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

#816 I created this issue, after it's done, you may do the tagging and referrer copying all in one line. For now, you need to 1) copy image and it's referrer for each arch(don't add tag in the destination reference) 2) tag the index in the destination.

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 15, 2023

#816 I created this issue, after it's done, you may do the tagging and referrer copying all in one line. For now, you need to 1) copy image and it's referrer for each arch(don't add tag in the destination reference) 2) tag the index in the destination.

what index do I tag ? do you have some examples of commands? because don't really see how to do the step2

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

For the errors, sorry I put wrong digest, should be the digest of index (I put s390x's). <- This only work if you run oras cp on v1.0.0-rc.1 without platform

oras manifest fetch --platform linux/amd64 xxx.azurecr.io/artifactstest@sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b # get manifest for linux/amd64
oras manifest fetch --platform linux/arm64 xxx.azurecr.io/artifactstest@sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b  # get manifest for linux/arm64

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

what index do I tag ? do you have some examples of commands? because don't really see how to do the step2

oras tag xxx.azurecr.io/artifactstest@sha256:4169ef297659f53e8660989efb6793578b14817982078592801d1522927f511b v1.0.0-rc1

Updated: try below if you want to get the index digest automatically:

oras tag xxx.azurecr.io/artifactstest@$(oras manifest fetch --descriptor local/oras:v1.0.0-rc1 --oci-layout | jq -r .digest) v1.0.0-rc1

@qweeah
Copy link
Contributor

qweeah commented Feb 15, 2023

Basically the #816 makes sure that you copy whatever you need in one line command and don't need to mess around with those digests.

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 15, 2023

Thanks for this command; for now it's work but need for me to run more test

@qweeah
Copy link
Contributor

qweeah commented Feb 16, 2023

@SamirPS After taking a close look at the code I realized that I have made some mistakes in my early replies. To clarify, Copying from a specific arch recursively will NOT cover the multi-arch index manifest and images in other architectures. (I have crossed out my false statements, sorry for the trouble)

@qweeah
Copy link
Contributor

qweeah commented Feb 16, 2023

@SamirPS Suppose you have a multi-arch image and artifacts attached to s390x image and index manifest:

graph TD
Z>v1] -..-> index
index -- linux/amd64 --> A[image]
index -- linux/arm64 --> B[image]
index -- linux/s390x --> C[image]
artifact0 --> index
artifact1 --> C
Loading

If you want to copy everything(index, artifact0, artifact1, all the images) from A to B, try bellow command:

# 1. copy the multi-arch image list
oras cp -r $A:v1 $B:v1 # this copies index, artifact0 and all images
# 2. copy EACH image with artifact attached (in this case s390x only)
oras cp -r $A@$DIGEST_OF_S390X $B # this copies artifact1

You can also replace A or B with registry+repository or OCI layout path.

After #818 is merged and released, you don't need to obtain the digest of a certain and can simply use below command:

# 1. copy the multi-arch image list
oras cp -r $A:v1 $B:v1 # this copies index, artifact0 and all images
# 2. copy EACH image with artifact attached (in this case s390x only)
oras cp -r $A:v1 $B --platform linux/s390x # this copies artifact1

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 16, 2023

@qweeah Thanks for the update. So if I understand well, if I have attached one artefact to the platform amd64 and one on s390x.

The workflow would be as follows:

oras cp -r $A:v1 $B:v1
oras cp -r $A@$DIGEST_OF_S390X $B
oras cp -r $A@$DIGEST_OF_amd64 $B

And these workflows permit sending all the images and the artefact on amd64 and s390x?

@SamirPS
Copy link
Contributor Author

SamirPS commented Feb 16, 2023

I have tested it and seem to work thanks @qweeah

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants