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
180 stars 39 forks source link

ContainerRepository value with a 'folder' that ends in a `'` doesn't give a good error #574

Open wisamidris7 opened 5 months ago

wisamidris7 commented 5 months ago

This is a sample blazor app i didn't even edited a character and that also happen why

dotnet publish "C:\Users\Administrator\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csproj" -p:PublishProfile="DefaultContainer" -p:PublishSingleFile="true" -p:PublishTrimmed="false" --self-contained "true" --verbosity "quiet" --nologo -r "linux-x64" -p:ContainerRepository="WASL./identity-api" -p:ContainerImageTag="latest"

C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: The
"CreateNewImage" task failed unexpectedly. [C:\Users\Administrator\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csp
roj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018: Micr
osoft.NET.Build.Containers.DockerLoadException: CONTAINER1009: Failed to load image from local registry. stdout: invali
d reference format [C:\Users\Administrator\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:  [C:
\Users\Administrator\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:    a
t Microsoft.NET.Build.Containers.DockerCli.LoadAsync(BuiltImage image, SourceImageReference sourceReference, Destinatio
nImageReference destinationReference, CancellationToken cancellationToken) in /_/src/Containers/Microsoft.NET.Build.Con
tainers/LocalDaemons/DockerCli.cs:line 107 [C:\Users\Administrator\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csp
roj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:    a
t Microsoft.NET.Build.Containers.Tasks.CreateNewImage.PushToLocalRegistryAsync(BuiltImage builtImage, SourceImageRefere
nce sourceImageReference, DestinationImageReference destinationImageReference, CancellationToken cancellationToken) in
/_/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs:line 200 [C:\Users\Administrator\source\repos\
BlazorApp29\BlazorApp29\BlazorApp29.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:    a
t Microsoft.NET.Build.Containers.Tasks.CreateNewImage.ExecuteAsync(CancellationToken cancellationToken) in /_/src/Conta
iners/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs:line 170 [C:\Users\Administrator\source\repos\BlazorApp29\
BlazorApp29\BlazorApp29.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:    a
t Microsoft.NET.Build.Containers.Tasks.CreateNewImage.Execute() in /_/src/Containers/Microsoft.NET.Build.Containers/Tas
ks/CreateNewImage.cs:line 36 [C:\Users\Administrator\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:    a
t Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [C:\Users\Administrato
r\source\repos\BlazorApp29\BlazorApp29\BlazorApp29.csproj]
C:\Program Files\dotnet\sdk\8.0.300\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error MSB4018:    a
t Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext
taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [C:\Users\Administrator\s
ource\repos\BlazorApp29\BlazorApp29\BlazorApp29.csproj]
wisamidris7 commented 5 months ago

ohh because the . in WASL./

baronfel commented 5 months ago

To me the fact that you weren't warned of this invalid name until after we created the image and tried to load it into the local Docker daemon is a bug. There are several pre-check steps that should have validated your ContainerRepository value and either normalized it to a valid value or errored out before doing any work. I'd like to reopen this to track that.