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
176 stars 30 forks source link

Publish hangs when using fully qualified repository/image name #491

Open rouen-sk opened 10 months ago

rouen-sk commented 10 months ago

If I run this using simple image name (without registry prefix), it works without problem. If I use registry prefix, it just hangs indefinitely. Registry is my real existing azurecr registry, but I am not authenticated for it before running publish:

d:\Devel\MyProject>dotnet publish MyProject.Api/MyProject.Api.csproj --os linux --arch x64 -p:PublishProfile=DefaultContainer -p:ContainerRepository=myregistry.azurecr.io/myproject-api:1.0.2
MSBuild version 17.6.8+c70978d4d for .NET
  Determining projects to restore...
  Restored d:\Devel\MyProject\MyProject.Domain\MyProject.Domain.csproj (in 134 ms).
  Restored d:\Devel\MyProject\MyProject.Api\MyProject.Api.csproj (in 318 ms).

(warnings about nullables omitted)

  MyProject.Api -> d:\Devel\MyProject\MyProject.Api\bin\Debug\net7.0\linux-x64\MyProject.Api.dll
  MyProject.Api -> d:\Devel\MyProject\MyProject.Api\bin\Debug\net7.0\linux-x64\publish\

(here it just hangs indefinitely... after pressing CTRL-C loops following)

Attempting to cancel the build...
C:\Users\rcervenak\.nuget\packages\microsoft.net.build.containers\7.0.400\build\Microsoft.NET.Build.Containers.targets(119,5): warning MSB4220: Waiting for the currently
 executing task "ParseContainerProperties" to cancel. [d:\Devel\MyProject\MyProject.Api\MyProject.Api.csproj]
C:\Users\rcervenak\.nuget\packages\microsoft.net.build.containers\7.0.400\build\Microsoft.NET.Build.Containers.targets(119,5): warning MSB4220: Waiting for the currently
 executing task "ParseContainerProperties" to cancel. [d:\Devel\MyProject\MyProject.Api\MyProject.Api.csproj]
C:\Users\rcervenak\.nuget\packages\microsoft.net.build.containers\7.0.400\build\Microsoft.NET.Build.Containers.targets(119,5): warning MSB4220: Waiting for the currently
 executing task "ParseContainerProperties" to cancel. [d:\Devel\MyProject\MyProject.Api\MyProject.Api.csproj]

It hangs in my local terminal, and also in Azure DevOps pipeline.

baronfel commented 10 months ago

Thanks for reporting! We don't support passing the fully-qualified name to ContainerRepository - instead we expect to see the 'repository' portion of that image: myproject-api. We could probably do more validation here when we parse the ContainerRepository property to warn a user they've not entered the correct expected values.