diff --git a/src/Containers/Microsoft.NET.Build.Containers/ContainerBuilder.cs b/src/Containers/Microsoft.NET.Build.Containers/ContainerBuilder.cs index 48867a93de6b..7c07bfa83f50 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/ContainerBuilder.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/ContainerBuilder.cs @@ -221,6 +221,11 @@ private static async Task PushToRemoteRegistryAsync(ILogger logger, BuiltIm cancellationToken)).ConfigureAwait(false); logger.LogInformation(Strings.ContainerBuilder_ImageUploadedToRegistry, destinationImageReference, destinationImageReference.RemoteRegistry.RegistryName); } + catch (UnableToDownloadFromRepositoryException e) + { + logger.LogError(Resource.FormatString(nameof(Strings.UnableToDownloadFromRepository)), sourceImageReference); + return 1; + } catch (UnableToAccessRepositoryException) { logger.LogError(Resource.FormatString(nameof(Strings.UnableToAccessRepository), destinationImageReference.Repository, destinationImageReference.RemoteRegistry!.RegistryName)); diff --git a/src/Containers/Microsoft.NET.Build.Containers/Exceptions/UnableToDownloadFromRepositoryException.cs b/src/Containers/Microsoft.NET.Build.Containers/Exceptions/UnableToDownloadFromRepositoryException.cs new file mode 100644 index 000000000000..de69816d497f --- /dev/null +++ b/src/Containers/Microsoft.NET.Build.Containers/Exceptions/UnableToDownloadFromRepositoryException.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +namespace Microsoft.NET.Build.Containers; + +internal sealed class UnableToDownloadFromRepositoryException : Exception +{ + public UnableToDownloadFromRepositoryException(string repository, string stackTrace) + : base($"The load of the image from registry {repository} has failed. Stack trace: {stackTrace}") + { + } +} diff --git a/src/Containers/Microsoft.NET.Build.Containers/Registry/Registry.cs b/src/Containers/Microsoft.NET.Build.Containers/Registry/Registry.cs index 20093b764c77..fb95e75aa213 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Registry/Registry.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/Registry/Registry.cs @@ -375,15 +375,22 @@ public async Task DownloadBlobAsync(string repository, Descriptor descri return localPath; } - // No local copy, so download one - using Stream responseStream = await _registryAPI.Blob.GetStreamAsync(repository, descriptor.Digest, cancellationToken).ConfigureAwait(false); - string tempTarballPath = ContentStore.GetTempFile(); - using (FileStream fs = File.Create(tempTarballPath)) + + try { - await responseStream.CopyToAsync(fs, cancellationToken).ConfigureAwait(false); - } + // No local copy, so download one + using Stream responseStream = await _registryAPI.Blob.GetStreamAsync(repository, descriptor.Digest, cancellationToken).ConfigureAwait(false); + using (FileStream fs = File.Create(tempTarballPath)) + { + await responseStream.CopyToAsync(fs, cancellationToken).ConfigureAwait(false); + } + } + catch (Exception e) + { + throw new UnableToDownloadFromRepositoryException(repository, e.ToString()); + } cancellationToken.ThrowIfCancellationRequested(); File.Move(tempTarballPath, localPath, overwrite: true); diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs b/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs index 45607eb642a2..2f0f8bbac8b8 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs @@ -861,6 +861,17 @@ internal static string UnableToAccessRepository } } + /// + /// Looks up a localized string similar to CONTAINER1018: Unable to download image from the repository '{0}'. Stack trace: {1}. + /// + internal static string UnableToDownloadFromRepository + { + get + { + return ResourceManager.GetString("UnableToDownloadFromRepository", resourceCulture); + } + } + /// /// Looks up a localized string similar to CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}.. /// diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.resx b/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.resx index f4d2e51f7d4c..926c5d06fbe0 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.resx +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.resx @@ -401,6 +401,10 @@ CONTAINER1015: Unable to access the repository '{0}' at tag '{1}' in the registry '{2}'. Please confirm that this name and tag are present in the registry. {StrBegins="CONTAINER1015: "} + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER1016: Unable to access the repository '{0}' in the registry '{1}'. Please confirm your credentials are correct and that you have access to this repository and registry. {StrBegins="CONTAINER1016:" } diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.cs.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.cs.xlf index debc49c84821..8119b107f981 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.cs.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.cs.xlf @@ -357,6 +357,11 @@ CONTAINER1016: Nelze získat přístup k úložišti „{0}“ v registru „{1}“. Ověřte prosím správnost vašich přihlašovacích údajů a to, že máte přístup k tomuto úložišti a registru. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: Neznámé AppCommandInstruction „{0}“. Platné pokyny jsou {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.de.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.de.xlf index 1ce325216acf..eb78c2d04b1c 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.de.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.de.xlf @@ -357,6 +357,11 @@ CONTAINER1016: Auf das Repository "{0}" in der Registrierung "{1}" kann nicht zugegriffen werden. Vergewissern Sie sich, dass Ihre Anmeldeinformationen korrekt sind und dass Sie Zugriff auf dieses Repository und die Registrierung haben. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: Unbekannte AppCommandInstruction "{0}". Gültige Anweisungen sind {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.es.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.es.xlf index b55ee4a78d28..1933b202f232 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.es.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.es.xlf @@ -357,6 +357,11 @@ CONTAINER1016: no se puede acceder al repositorio ''{0}'' en el registro ''{1}''. Confirme que las credenciales son correctas y que tiene acceso a este repositorio y registro. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: AppCommandInstruction ''{0}desconocido. Las instrucciones válidas son {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.fr.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.fr.xlf index 32970ca755f2..7690d7015a2b 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.fr.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.fr.xlf @@ -357,6 +357,11 @@ CONTAINER1016: nous n’avons pas pu accéder au référentiel '{0}' dans le Registre '{1}'. Confirmez que vos informations d’identification sont correctes et que vous avez accès à ce référentiel et à ce Registre. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: instruction de commande d'application inconnue '{0}'. Les instructions valides sont {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.it.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.it.xlf index 5bc90ed6527b..263b06535cd4 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.it.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.it.xlf @@ -357,6 +357,11 @@ CONTAINER1016: impossibile accedere al repository '{0}' nel Registro di sistema '{1}'. Verificare che le credenziali siano corrette e di avere accesso a questo repository e registro. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: appCommandInstruction '{0}'sconosciuta. Istruzioni valide sono {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ja.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ja.xlf index 0624726f1ba4..1cf2e14dfdf2 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ja.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ja.xlf @@ -357,6 +357,11 @@ CONTAINER1016: レジストリ '{1}' のリポジトリ '{0}' にアクセスできません。資格情報が正しいこと、およびこのリポジトリとレジストリへのアクセス権があることを確認してください。 {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: 不明な AppCommandInstruction '{0}'。有効な手順は {1} です。 diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ko.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ko.xlf index 7f89fbdee47b..865f2ca024fb 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ko.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ko.xlf @@ -357,6 +357,11 @@ CONTAINER1016: '{1}' 레지스트리의 '{0}' 리포지토리에 액세스할 수 없습니다. 자격 증명이 올바르고 이 리포지토리 및 레지스트리에 액세스할 수 있는지 확인하세요. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: 알 수 없는 AppCommandInstruction '{0}'. 올바른 지침은 {1}입니다. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pl.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pl.xlf index 97e6b30b4686..4d0555473519 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pl.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pl.xlf @@ -357,6 +357,11 @@ CONTAINER1016: nie można uzyskać dostępu do repozytorium „{0}” w rejestrze „{1}”. Upewnij się, że poświadczenia są poprawne oraz że masz dostęp do tego repozytorium i rejestru. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: Nieznana instrukcja AppCommandInstruction „{0}”. Prawidłowe instrukcje to{1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pt-BR.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pt-BR.xlf index 49fb2096e3bf..731db46abaa3 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.pt-BR.xlf @@ -357,6 +357,11 @@ CONTAINER1016: não é possível acessar o repositório ''{0}'' no registro ''{1}''. Confirme se suas credenciais estão corretas e se você tem acesso a este repositório e ao Registro. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: AppCommandInstruction desconhecido '{0}'. As instruções válidas são {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ru.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ru.xlf index 1632e686dc2b..d4c668f6c0b6 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ru.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.ru.xlf @@ -357,6 +357,11 @@ CONTAINER1016: не удается получить доступ к репозиторию "{0}" в реестре "{1}". Убедитесь, что ваши учетные данные верны и что у вас есть доступ к этому репозиторию и реестру. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: неизвестный элемент AppCommandInstruction "{0}". Допустимые инструкции: {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.tr.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.tr.xlf index 8612f7609a21..8fbc042a5858 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.tr.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.tr.xlf @@ -357,6 +357,11 @@ CONTAINER1016: '{1}' kayıt defterindeki '{0}' deposuna erişilemedi. Lütfen kimlik bilgilerinizin doğru olduğunu ve bu depoya ve kayıt defterine erişiminiz olduğunu onaylayın. {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: AppCommandInstruction '{0}' bilinmiyor. Geçerli yönergeler {1}. diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hans.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hans.xlf index 66e05bef0799..3f9036d6730b 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hans.xlf @@ -357,6 +357,11 @@ CONTAINER1016: 无法访问注册表“{1}”中的存储库“{0}”。请确认你的凭据正确无误,并且你有权访问此存储库和注册表。 {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: AppCommandInstruction“{0}”未知。有效的说明为 {1}。 diff --git a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hant.xlf b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hant.xlf index 9eb252891e5a..7473c25aebce 100644 --- a/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Containers/Microsoft.NET.Build.Containers/Resources/xlf/Strings.zh-Hant.xlf @@ -357,6 +357,11 @@ CONTAINER1016: 無法存取登錄 '{1}' 中的存放庫 '{0}'。請確認您的認證正確,且您擁有此存放庫和登錄的存取權。 {StrBegins="CONTAINER1016:" } + + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + CONTAINER1018: Unable to download image from the repository '{0}''. Stack trace: {1} + {StrBegins="CONTAINER1018:" } + CONTAINER2021: Unknown AppCommandInstruction '{0}'. Valid instructions are {1}. CONTAINER2021: 未知的 AppCommandInstruction '{0}'。有效的指示為 {1}。