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

Cannot oras push artifact with 0.14.0: Error PUT ... unexpected status code 400: Bad Request #532

Closed
mathieu-benoit opened this issue Sep 3, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@mathieu-benoit
Copy link

mathieu-benoit commented Sep 3, 2022

With oras 0.13.0, I'm able to accomplish this successfully:

cat <<EOF> test-namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
  name: test
EOF
tar -cf test-namespace.tar test-namespace.yaml
oras push \
    $region-docker.pkg.dev/$project/$containerRegistryName/my-namespace-artifact:v1 \
    test-namespace.tar

But with oras 0.14.0, I'm getting this error:

Error: PUT "https://us-east4-docker.pkg.dev/artifacts-uploads/namespaces/mabenoit-oci-cs/repositories/oci-artifacts/uploads/...=sha256%...": unexpected status code 400: Bad Request

Is there a known issue with oras push? Or am I missing something since the 0.14.0 version?

My OCI registry is Google Artifact Registry.

@mathieu-benoit mathieu-benoit changed the title Cannot push artifact with 0.14.0: Error PUT ... unexpected status code 400: Bad Request Cannot oras push artifact with 0.14.0: Error PUT ... unexpected status code 400: Bad Request Sep 3, 2022
@qweeah
Copy link
Contributor

qweeah commented Sep 4, 2022

@mathieu-benoit Can you provide detailed logs via setting the debug flag? like

oras push --debug\
    $region-docker.pkg.dev/$project/$containerRegistryName/my-namespace-artifact:v1 \
    test-namespace.tar

Thanks

@mathieu-benoit
Copy link
Author

mathieu-benoit commented Sep 4, 2022

Sure thing @qweeah, here you are:

With 0.14.0:
DEBU[0000]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/manifests/sha256:9e82c328bce0b04d3220422649605a99b98e04c8237a759b5cf88f68ef9a8c6c" 
DEBU[0000]  Request method: "HEAD"                      
DEBU[0000]  Request headers:                            
DEBU[0000]    "User-Agent": "oras/0.14.0"               
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.cncf.oras.artifact.manifest.v1+json" 
DEBU[0000]  Response Status: "401 Unauthorized"         
DEBU[0000]  Response headers:                           
DEBU[0000]    "Content-Type": "application/json"        
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0000]    "X-Xss-Protection": "0"                   
DEBU[0000]    "Date": "Sun, 04 Sep 2022 16:10:21 GMT"   
DEBU[0000]    "Www-Authenticate": "Bearer realm=\"https://us-east4-docker.pkg.dev/v2/token\",service=\"us-east4-docker.pkg.dev\",scope=\"repository:mabenoit-oci-cs/oci-artifacts/my-namespace-artifact:pull\"" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Content-Length": "102"                   
DEBU[0000]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/token?scope=repository%3Amabenoit-oci-cs%2Foci-artifacts%2Fmy-namespace-artifact%3Apull&service=us-east4-docker.pkg.dev" 
DEBU[0001]  Request method: "GET"                       
DEBU[0001]  Request headers:                            
DEBU[0001]    "User-Agent": "oras/0.14.0"               
DEBU[0001]    "Authorization": "*****"                  
DEBU[0001]  Response Status: "200 OK"                   
DEBU[0001]  Response headers:                           
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:10:22 GMT"   
DEBU[0001]    "Content-Length": "710"                   
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]    "Content-Type": "application/json"        
DEBU[0001]    "X-Content-Type-Options": "nosniff"       
DEBU[0001]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0001]    "X-Xss-Protection": "0"                   
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/manifests/sha256:9e82c328bce0b04d3220422649605a99b98e04c8237a759b5cf88f68ef9a8c6c" 
DEBU[0001]  Request method: "HEAD"                      
DEBU[0001]  Request headers:                            
DEBU[0001]    "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.cncf.oras.artifact.manifest.v1+json" 
DEBU[0001]    "Authorization": "*****"                  
DEBU[0001]    "User-Agent": "oras/0.14.0"               
DEBU[0001]  Response Status: "404 Not Found"            
DEBU[0001]  Response headers:                           
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:10:22 GMT"   
DEBU[0001]    "Content-Length": "85"                    
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]    "Content-Type": "application/json"        
DEBU[0001]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0001]    "X-Content-Type-Options": "nosniff"       
DEBU[0001]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0001]    "X-Xss-Protection": "0"                   
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/blobs/sha256:defbc7e7a33667e29a50e92aa639036802d10b874d1de4d1597d5fff0d8654be" 
DEBU[0001]  Request method: "HEAD"                      
DEBU[0001]  Request headers:                            
DEBU[0001]    "Authorization": "*****"                  
DEBU[0001]    "User-Agent": "oras/0.14.0"               
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/blobs/sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" 
DEBU[0001]  Request method: "HEAD"                      
DEBU[0001]  Request headers:                            
DEBU[0001]    "Authorization": "*****"                  
DEBU[0001]    "User-Agent": "oras/0.14.0"               
DEBU[0001]  Response Status: "200 OK"                   
DEBU[0001]  Response headers:                           
DEBU[0001]    "Content-Length": "10240"                 
DEBU[0001]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:10:22 GMT"   
DEBU[0001]    "Content-Type": "text/html; charset=UTF-8" 
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
Exists    defbc7e7a336 test-namespace.tar
DEBU[0001]  Response Status: "404 Not Found"            
DEBU[0001]  Response headers:                           
DEBU[0001]    "Content-Type": "application/json"        
DEBU[0001]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0001]    "X-Content-Type-Options": "nosniff"       
DEBU[0001]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0001]    "X-Xss-Protection": "0"                   
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:10:22 GMT"   
DEBU[0001]    "Content-Length": "158"                   
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/blobs/uploads/" 
DEBU[0001]  Request method: "POST"                      
DEBU[0001]  Request headers:                            
DEBU[0001]    "User-Agent": "oras/0.14.0"               
DEBU[0001]  Response Status: "401 Unauthorized"         
DEBU[0001]  Response headers:                           
DEBU[0001]    "Content-Type": "application/json"        
DEBU[0001]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0001]    "X-Content-Type-Options": "nosniff"       
DEBU[0001]    "X-Xss-Protection": "0"                   
DEBU[0001]    "Content-Length": "102"                   
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]    "Www-Authenticate": "Bearer realm=\"https://us-east4-docker.pkg.dev/v2/token\",service=\"us-east4-docker.pkg.dev\",scope=\"repository:mabenoit-oci-cs/oci-artifacts/my-namespace-artifact:pull,push\"" 
DEBU[0001]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:10:23 GMT"   
DEBU[0002]  Request URL: "https://us-east4-docker.pkg.dev/v2/token?scope=repository%3Amabenoit-oci-cs%2Foci-artifacts%2Fmy-namespace-artifact%3Apull%2Cpush&service=us-east4-docker.pkg.dev" 
DEBU[0002]  Request method: "GET"                       
DEBU[0002]  Request headers:                            
DEBU[0002]    "User-Agent": "oras/0.14.0"               
DEBU[0002]    "Authorization": "*****"                  
DEBU[0002]  Response Status: "200 OK"                   
DEBU[0002]  Response headers:                           
DEBU[0002]    "X-Content-Type-Options": "nosniff"       
DEBU[0002]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0002]    "X-Xss-Protection": "0"                   
DEBU[0002]    "Date": "Sun, 04 Sep 2022 16:10:23 GMT"   
DEBU[0002]    "Content-Length": "710"                   
DEBU[0002]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0002]    "Content-Type": "application/json"        
DEBU[0002]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/blobs/uploads/" 
DEBU[0002]  Request method: "POST"                      
DEBU[0002]  Request headers:                            
DEBU[0002]    "Authorization": "*****"                  
DEBU[0002]    "User-Agent": "oras/0.14.0"               
DEBU[0002]  Response Status: "202 Accepted"             
DEBU[0002]  Response headers:                           
DEBU[0002]    "Content-Length": "0"                     
DEBU[0002]    "X-Content-Type-Options": "nosniff"       
DEBU[0002]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0002]    "X-Xss-Protection": "0"                   
DEBU[0002]    "Date": "Sun, 04 Sep 2022 16:10:23 GMT"   
DEBU[0002]    "Content-Type": "text/html; charset=UTF-8" 
DEBU[0002]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0002]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0002]    "Docker-Upload-Uuid": "AB38jmIJaP3zfWaQmmGgQCEULDCSpJFyIGrFexQ8xFK8fLRLuzcrg-cMjC_q3spyPXf0jrCkpTBuuPEvS1Xn5eJSM3EgBCTodHI437cYnQ3mQp0Z-AVSvtZqHLF9RaAKZfbHdvjw7vBtc1X9kKk65Jy7WLHdgzhydoGVwnZKJXXlVMmBuTmFWciyG22mEiPPQ9PogftM8vt9qlTGpNLDe_bgLm3v-uCvHwTdsLS2wvI4kOPoEgab4Yr6RB73Alb4XZ6jeqDgDCmJOY726pBcYPsQ67oirCGZa05eVQeCVT87M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gdL7biXI3lqbhf1y-maKI4Ib_LDF1VtNIGH7pQFsyC7FbLtaVoG2nZ8lKQlNAHszPNnLccMEwyaV7c0BbrHfAQvCdhvNVw4NdaY3IdMnEGFnfznk1UZks5pn_le-abdYml4gri" 
DEBU[0002]  Request URL: "https://us-east4-docker.pkg.dev/artifacts-uploads/namespaces/mabenoit-oci-cs/repositories/oci-artifacts/uploads/AB38jmIJaP3zfWaQmmGgQCEULDCSpJFyIGrFexQ8xFK8fLRLuzcrg-cMjC_q3spyPXf0jrCkpTBuuPEvS1Xn5eJSM3EgBCTodHI437cYnQ3mQp0Z-AVSvtZqHLF9RaAKZfbHdvjw7vBtc1X9kKk65Jy7WLHdgzhydoGVwnZKJXXlVMmBuTmFWciyG22mEiPPQ9PogftM8vt9qlTGpNLDe_bgLm3v-uCvHwTdsLS2wvI4kOPoEgab4Yr6RB73Alb4XZ6jeqDgDCmJOY726pBcYPsQ67oirCGZa05eVQeCVT87Mytk5dooY76bAueXieI8HrLQFTdhGcAbTlu0Tw48pJ6nKho39Sa_n55x1KIIoudd_0EYU7d3PlQE7mfxaQKPkkofQSCN16M1mee7nU6oKZxLnVNkWKA_qq0Coz4cUt2O-61ypN5yMYtqY915JCGEc_VDx3PfM9KIyY4Dfhl1n35xTqnVnkmi3vIHyZ7kcNKnLZ0UkdFQdzMam1O3mzb6larbZ54DyKdSkpl6txVa0Js4byG_0zCjxK5gGDZGELabot_fZ7iV5HesPCVsMtWNWB1W2SDmlIvQsSeNj2KaS21tjwxeL1RLX4s3Nw6QvwzfLhyVTq1vKFVF11RHPVAhPaoPSZzjLDveW--85ULyjZXtsUy6D3t5ZPo9M8QkmaD8vFmLE4NOTQBFmyRkgAh9jRHAZ25CLAAwn_X0XTb8vHvyn-vDZ2hG-usYuZ7kpJc5owfgFTCLNTht0sUD5i6-A3bq32qZYdTuY15VWc8phVmaYQIuCFrZ-1e3P2oiUfctFxsk22zUIwL_PQX_8-clUTS-FpU1d0j-kKE_SznPQ2BJ-TJxIy-UDrtCO6aAvpqSUl3VYMbUAEYkMRvzw5-DbPi50cBMs6-ff72RIz-nQKKDGmFAC2rJMEnvhov1QCdPk6X_-CEKYZmbQtgFES9CmpPbBHWJnVlMYtaBLIW8WTvSWDOhWLNQV0BHLxMYn3hA5LNBWRh101-Inffwxfi5nACZRnNBeNfwpi963fpy5Jgz0RvbbmV6xG_DPvrFRyDtvF4_JqwA5aAwGEYbLW60bTtsir4eyAIJjlKPSVv9qA8Nj5-4ppWArlRW34gdL7biXI3lqbhf1y-maKI4Ib_LDF1VtNIGH7pQFsyC7FbLtaVoG2nZ8lKQlNAHszPNnLccMEwyaV7c0BbrHfAQvCdhvNVw4NdaY3IdMnEGFnfznk1UZks5pn_le-abdYml4gri?digest=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" 
DEBU[0002]  Request method: "PUT"                       
DEBU[0002]  Request headers:                            
DEBU[0002]    "Authorization": "*****"                  
DEBU[0002]    "User-Agent": "oras/0.14.0"               
DEBU[0002]    "Content-Type": "application/octet-stream" 
DEBU[0002]  Response Status: "400 Bad Request"          
DEBU[0002]  Response headers:                           
DEBU[0002]    "Server": "UploadServer"                  
DEBU[0002]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0002]    "Content-Type": "text/plain; charset=utf-8" 
DEBU[0002]    "X-Guploader-Uploadid": "ADPycdvSOGpNea4uFQq8oiuWxc4K-w6BrcZEXbQmGZSbokHU7cVaqUnV-Pz-yrRNfDrjD0T2XoucgYgx3NMIoIqeYFWnKg" 
DEBU[0002]    "Content-Length": "25"                    
DEBU[0002]    "Date": "Sun, 04 Sep 2022 16:10:24 GMT"   
Error: PUT "https://us-east4-docker.pkg.dev/artifacts-uploads/namespaces/mabenoit-oci-cs/repositories/oci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vrFRyDtvF4_JqwA5aAwGEYbLW60bTtsir4eyAIJjlKPSVv9qA8Nj5-4ppWArlRW34gdL7biXI3lqbhf1y-maKI4Ib_LDF1VtNIGH7pQFsyC7FbLtaVoG2nZ8lKQlNAHszPNnLccMEwyaV7c0BbrHfAQvCdhvNVw4NdaY3IdMnEGFnfznk1UZks5pn_le-abdYml4gri?digest=sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855": unexpected status code 400: Bad Request
With 0.13.0:
DEBU[0000]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/manifests/sha256:91163a277d711e85b230c3c1ab18ef8602a902e09c7cec7298e7de7cfc94ec71" 
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.cncf.oras.artifact.manifest.v1+json" 
DEBU[0000]    "User-Agent": "oras/0.13.0"               
DEBU[0000]  Response Status: "401 Unauthorized"         
DEBU[0000]  Response headers:                           
DEBU[0000]    "Content-Type": "application/json"        
DEBU[0000]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0000]    "Www-Authenticate": "Bearer realm=\"https://us-east4-docker.pkg.dev/v2/token\",service=\"us-east4-docker.pkg.dev\",scope=\"repository:mabenoit-oci-cs/oci-artifacts/my-namespace-artifact:pull\"" 
DEBU[0000]    "X-Content-Type-Options": "nosniff"       
DEBU[0000]    "Content-Length": "102"                   
DEBU[0000]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0000]    "X-Xss-Protection": "0"                   
DEBU[0000]    "Date": "Sun, 04 Sep 2022 16:19:04 GMT"   
DEBU[0000]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/token?scope=repository%3Amabenoit-oci-cs%2Foci-artifacts%2Fmy-namespace-artifact%3Apull&service=us-east4-docker.pkg.dev" 
DEBU[0001]  Request method: "GET"                       
DEBU[0001]  Request headers:                            
DEBU[0001]    "User-Agent": "oras/0.13.0"               
DEBU[0001]    "Authorization": "*****"                  
DEBU[0001]  Response Status: "200 OK"                   
DEBU[0001]  Response headers:                           
DEBU[0001]    "Content-Length": "710"                   
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
DEBU[0001]    "Content-Type": "application/json"        
DEBU[0001]    "X-Content-Type-Options": "nosniff"       
DEBU[0001]    "X-Frame-Options": "SAMEORIGIN"           
DEBU[0001]    "X-Xss-Protection": "0"                   
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:19:05 GMT"   
DEBU[0001]  Request URL: "https://us-east4-docker.pkg.dev/v2/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact/manifests/sha256:91163a277d711e85b230c3c1ab18ef8602a902e09c7cec7298e7de7cfc94ec71" 
DEBU[0001]  Request method: "HEAD"                      
DEBU[0001]  Request headers:                            
DEBU[0001]    "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.cncf.oras.artifact.manifest.v1+json" 
DEBU[0001]    "Authorization": "*****"                  
DEBU[0001]    "User-Agent": "oras/0.13.0"               
DEBU[0001]  Response Status: "200 OK"                   
DEBU[0001]  Response headers:                           
DEBU[0001]    "Content-Length": "464"                   
DEBU[0001]    "Content-Type": "application/vnd.oci.image.manifest.v1+json" 
DEBU[0001]    "Docker-Content-Digest": "sha256:91163a277d711e85b230c3c1ab18ef8602a902e09c7cec7298e7de7cfc94ec71" 
DEBU[0001]    "Docker-Distribution-Api-Version": "registry/2.0" 
DEBU[0001]    "Date": "Sun, 04 Sep 2022 16:19:05 GMT"   
DEBU[0001]    "Alt-Svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"" 
Exists    91163a277d71 
Pushed us-east4-docker.pkg.dev/mabenoit-oci-cs/oci-artifacts/my-namespace-artifact:v1
Digest: sha256:91163a277d711e85b230c3c1ab18ef8602a902e09c7cec7298e7de7cfc94ec71

Apparently the 401 Unauthorized error happens for both version but the 404 Not Found error is just for 0.14.0.

Does this help?

@qweeah
Copy link
Contributor

qweeah commented Sep 5, 2022

401 Unauthorized is expected since it's the first step of oauth flow

400 is returned for uploading blob sha256%3Ae3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, which is the checksum of empty string (checked with below commands):

$ echo -n "" | sha256sum
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  -

The root cause is: in 0.14.0, the the default image config is changed from {} to empty string ("") in oras-go and GAR returns 400 for that. It is an valid blob for distribution though.

@qweeah
Copy link
Contributor

qweeah commented Sep 5, 2022

@mathieu-benoit You can work this around by using --config to specify a non-empty config, see command below:

echo "{}" > config
oras push \
    $region-docker.pkg.dev/$project/$containerRegistryName/my-namespace-artifact:v1 \
    --config config \
    test-namespace.tar

@qweeah
Copy link
Contributor

qweeah commented Sep 5, 2022

I also created a issue for that oras-project/oras-go#294
cc @shizhMSFT @sajayantony @Wwwsylvia @m5i-work

@qweeah
Copy link
Contributor

qweeah commented Sep 5, 2022

Closing this as it will be further discussed & fixed in oras-project/oras-go

@qweeah qweeah closed this as completed Sep 5, 2022
@FeynmanZhou
Copy link
Member

FeynmanZhou commented Sep 5, 2022

Closing this as it will be further discussed & fixed in oras-project/oras-go

@mathieu-benoit ORAS CLI will release a patch for this bug today.
@qweeah I would suggest leaving this open and waiting for @mathieu-benoit to test and verify the new patch of ORAS CLI with GAR later.

@FeynmanZhou FeynmanZhou reopened this Sep 5, 2022
@FeynmanZhou FeynmanZhou added the bug Something isn't working label Sep 5, 2022
@mathieu-benoit
Copy link
Author

Wonderful, thanks @qweeah and @FeynmanZhou for your help and the fix. I just tested oras push and oras pull with 0.14.1, and it's now working succesfully, thanks!

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

No branches or pull requests

3 participants