Skip to content

Commit 88c613a

Browse files
Surayya Huseyn ZadaSurayya Huseyn Zada
authored andcommitted
refactor CreateImageIndex task; improve logging; log tip for enabling conrainerd
1 parent 5e38e73 commit 88c613a

22 files changed

+355
-191
lines changed

src/Containers/Microsoft.NET.Build.Containers/ImagePublisher.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ await PushToLocalRegistryAsync(
7474
telemetry,
7575
cancellationToken,
7676
destinationImageReference.LocalRegistry!.LoadAsync,
77-
Strings.ContainerBuilder_ImageUploadedToLocalDaemon).ConfigureAwait(false);
77+
Strings.ContainerBuilder_ImageUploadedToLocalDaemon,
78+
logWarningForMultiArch : true).ConfigureAwait(false);
7879
break;
7980
case DestinationImageReferenceKind.RemoteRegistry:
8081
await PushToRemoteRegistryAsync(
@@ -112,7 +113,8 @@ private static async Task PushToLocalRegistryAsync<T>(
112113
Telemetry telemetry,
113114
CancellationToken cancellationToken,
114115
Func<T, SourceImageReference, DestinationImageReference, CancellationToken, Task> loadFunc,
115-
string successMessage)
116+
string successMessage,
117+
bool logWarningForMultiArch = false)
116118
{
117119
ILocalRegistry localRegistry = destinationImageReference.LocalRegistry!;
118120
if (!(await localRegistry.IsAvailableAsync(cancellationToken).ConfigureAwait(false)))
@@ -145,6 +147,15 @@ private static async Task PushToLocalRegistryAsync<T>(
145147
{
146148
Log.LogErrorFromException(argEx, showStackTrace: false);
147149
}
150+
catch (DockerLoadException dle)
151+
{
152+
telemetry.LogLocalLoadError();
153+
Log.LogErrorFromException(dle, showStackTrace: false);
154+
if (logWarningForMultiArch && dle.Message.Contains("no such file or directory"))
155+
{
156+
Log.LogMessage(MessageImportance.High, "Tip: For multi-arch image publishing, ensude that 'Use containerd for pulling and storing images' is checked in Docker Desktop settings.");
157+
}
158+
}
148159
}
149160

150161
private static async Task PushToRemoteRegistryAsync<T>(

src/Containers/Microsoft.NET.Build.Containers/PublicAPI/net8.0/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.GeneratedArchiveOutputPath
3434
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.Cancel() -> void
3535
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.CreateImageIndex() -> void
3636
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.Dispose() -> void
37-
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.GeneratedImageIndex.get -> string!
38-
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.GeneratedImageIndex.set -> void
3937
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.ImageTags.get -> string![]!
4038
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.ImageTags.set -> void
4139
Microsoft.NET.Build.Containers.Tasks.CreateImageIndex.GeneratedContainers.get -> Microsoft.Build.Framework.ITaskItem![]!

src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs

Lines changed: 22 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.resx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@
358358
<value>Building image '{0}' with tags '{1}' on top of base image '{2}'.</value>
359359
<comment/>
360360
</data>
361+
<data name="ContainerBuilder_StartBuildingImageForRid" xml:space="preserve">
362+
<value>Building image '{0}' for runtime identifier '{1}' on top of base image '{2}'.</value>
363+
<comment/>
364+
</data>
361365
<data name="BuildingImageIndex" xml:space="preserve">
362366
<value>Building image index '{0}' on top of manifests {1}.</value>
363367
<comment>
@@ -369,15 +373,19 @@
369373
<comment/>
370374
</data>
371375
<data name="UnsupportedMediaType" xml:space="preserve">
372-
<value>Cannot create manifest list (image index) for the provided 'mediaType' = '{0}'.</value>
376+
<value>Cannot create image index for the provided 'mediaType' = '{0}'.</value>
373377
<comment/>
374378
</data>
375379
<data name="ImagesEmpty" xml:space="preserve">
376-
<value>Cannot create manifest list (image index) because no images were provided.</value>
380+
<value>Cannot create image index because no images were provided.</value>
377381
<comment/>
378382
</data>
379383
<data name="InvalidImageMetadata" xml:space="preserve">
380-
<value>Cannot create manifest list (image index) because provided images are invalid. Items must have 'Config', 'Manifest', 'ManifestMediaType' and 'ManifestDigest' metadata.</value>
384+
<value>Cannot create image index because provided images are invalid. Items must have 'Config', 'Manifest', 'ManifestMediaType' and 'ManifestDigest' metadata.</value>
385+
<comment/>
386+
</data>
387+
<data name="InvalidImageManifest" xml:space="preserve">
388+
<value>Cannot create image index because at least one of the provided images manifest is invalid.</value>
381389
<comment/>
382390
</data>
383391
<data name="ImageIndex_PodmanNotSupported" xml:space="preserve">

src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.cs.xlf

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.de.xlf

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.es.xlf

Lines changed: 16 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)