dotnet / dotnet/sdk

PublishContainer with an invalid ContainerBaseImage does not fail the build.

Open
#44,164 1 comment 0 reactions 0 assignees View on GitHub
Area-Containers Area-NetSDK
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### 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 `mcr.microsoft.com/foobar:8.0` to your project and call `msbuild '/t:Publish;PublishContainer' -v:detailed .\.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:
`foobar.com/foobar:8.0`
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\

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.