dotnet / sdk-container-builds

Libraries and build tooling to create container images from .NET projects using MSBuild
https://learn.microsoft.com/en-us/dotnet/core/docker/publish-as-container
MIT License
175 stars 30 forks source link

Build fails when using ContainerBaseImage hosted within Quay with Ceph storage backplane #566

Open almostjulian opened 2 months ago

almostjulian commented 2 months ago

I am using a custom base image using the ContainerBaseImage tag in my csproj. The repository the base image is in is using an internal Quay server, backed by a Ceph storage backend. When I try to run dotnet publish I get (from verbose logs):

 Task "CreateNewImage"
         Request URI: GET https://<redacted quay url>
         2b4ba5280a4ceda629c17922b62441b7
         Status code: Found
         Response headers:
         Accept-Ranges: bytes
         Cache-Control: max-age=31536000
         Date: Fri, 03 May 2024 21:56:05 GMT
         Docker-Content-Digest: sha256:f31c5da86bbd82708860371e4d9f23682b4ba5280a4ceda629c17922b62441b7
         Location: http://<redacted ceph backplane url>
         Server: nginx/1.20.1
         X-Frame-Options: DENY

         Response content: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
         <title>Redirecting...</title>
         <h1>Redirecting...</h1>
         <p>You should be redirected automatically to target URL: <a href="http://<redaced ceph url>/">http://<redacted ceph url></a>.  If not click the link.

1:7>C:\Program Files\dotnet\sdk\8.0.300-preview.24203.14\Containers\build\Microsoft.NET.Build.Containers.targets(219,5): err
       or : ContainerHttpException: Containerize: error CONTAINER004: CONTAINER1014: Manifest pull failed. [<redacted project name>]
       C:\Program Files\dotnet\sdk\8.0.300-preview.24203.14\Containers\build\Microsoft.NET.Build.Containers.targets(219,5): err
       or : URI: https://<redacted quay url> [<redacted project name>]
       C:\Program Files\dotnet\sdk\8.0.300-preview.24203.14\Containers\build\Microsoft.NET.Build.Containers.targets(219,5): err
       or :  [<redacted project name>]
       Done executing task "CreateNewImage" -- FAILED.

Is the httpclient being used to fetch this stuff not configured to follow redirects?

tmds commented 1 month ago

cc @baronfel

Is the httpclient being used to fetch this stuff not configured to follow redirects?

I would expect it to, but it's strange we're seeing the the Redirect response being printed in the log.

8.0.300-preview.24203.14

@almostjulian does it behave exactly the same if you use the 8.0.104 SDK?

Can you also try if it makes a difference if you pass your credentials through the envvars (SDK_CONTAINER_REGISTRY_UNAME and SDK_CONTAINER_REGISTRY_PWORD)?

almostjulian commented 1 month ago

@almostjulian does it behave exactly the same if you use the 8.0.104 SDK?

Can you also try if it makes a difference if you pass your credentials through the envvars (SDK_CONTAINER_REGISTRY_UNAME and SDK_CONTAINER_REGISTRY_PWORD)?

Yes, same behavior in 8.0.104. Envvars do not make a difference.

almostjulian commented 1 month ago

I think the issue is that the Ceph backend is http and I don't think https -> http autoredirect is allowed. I'll see if that's a config change we can make on our end.