dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

PublishContainer with an invalid ContainerBaseImage does not fail the build. #44164

Open patverb opened 1 week ago

patverb commented 1 week ago

Describe the bug

When calling the PublishContainer target with an invalid ContainerBaseImage tag that has a valid base URL, the task will error, but not log in the correct msbuild error format so the build will not fail.

To Reproduce

Add the property <ContainerBaseImage>mcr.microsoft.com/foobar:8.0</ContainerBaseImage> to your project and call msbuild '/t:Publish;PublishContainer' -v:detailed .\<project>.csproj.

This will log the line No host object detected. fail: Containerize[0] CONTAINER1015: Unable to access the repository 'foobar' at tag '8.0' in the registry 'mcr.microsoft.com'. Please confirm that this name and tag are present in the registry. In the build output but the build will still succeed.

Exceptions (if any)

If there are other problem with the base URL, such as an invalid URL or SSL issues, the build will fail but give a generic "dotnet.exe" exited with code 1. There is more info about the http errors that occur in the logs but a better failure message when the \ is invalid would be nice.

Example: <ContainerBaseImage>foobar.com/foobar:8.0</ContainerBaseImage> This gives the generic dotnet.exe exited with code 1 but in the logs the issue is with SSL not being able to be established.

Further technical details

.NET SDK: Version: 9.0.100-rc.1.24452.12 Commit: 81a714c6d3 Workload version: 9.0.100-manifests.67cd1eb6 MSBuild version: 17.12.0-preview-24422-09+d17ec720d

Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100-rc.1.24452.12\

nagilson commented 1 week ago

@dotnet/sdk-container-builds-maintainers Please help decide how to prioritize this issue.