From 7736546488278778dde535b0bf0b9f30fab53f7c Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Wed, 28 Apr 2021 11:38:34 -0700 Subject: [PATCH] Don't fail if AzdoApiToken or ArtifactsBasePath are empty if UseStreamingPublishing is false (#7308) These are not required if not using streaming publishing, as is the case when publishing post-build signed assets --- .../src/PublishArtifactsInManifestBase.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs index 8cf716cf8c0..8991ca8b081 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/PublishArtifactsInManifestBase.cs @@ -124,6 +124,14 @@ public abstract class PublishArtifactsInManifestBase : Microsoft.Build.Utilities private readonly string AzureDevOpsBaseUrl = $"https://dev.azure.com"; + /// + /// Instead of relying on pre-downloaded artifacts, 'stream' artifacts in from the input build. + /// Artifacts are downloaded one by one from the input build, and then immediately published and deleted. + /// This allows for faster publishing by utilizing both upload and download pipes at the same time, + /// and reduces maximum disk usage. + /// This is not appplicable if the input build does not contain the artifacts for publishing + /// (e.g. when publishing post-build signed assets) + /// public bool UseStreamingPublishing { get; set; } public readonly Dictionary> FeedConfigs = @@ -1853,14 +1861,14 @@ protected bool AnyMissingRequiredBaseProperties() Log.LogError($"The property {nameof(BuildAssetRegistryToken)} is required but doesn't have a value set."); } - if (string.IsNullOrEmpty(AzdoApiToken)) + if (UseStreamingPublishing && string.IsNullOrEmpty(AzdoApiToken)) { - Log.LogError($"The property {nameof(AzdoApiToken)} is required but doesn't have a value set."); + Log.LogError($"The property {nameof(AzdoApiToken)} is required when using streaming publishing, but doesn't have a value set."); } - if (string.IsNullOrEmpty(ArtifactsBasePath)) + if (UseStreamingPublishing && string.IsNullOrEmpty(ArtifactsBasePath)) { - Log.LogError($"The property {nameof(ArtifactsBasePath)} is required but doesn't have a value set."); + Log.LogError($"The property {nameof(ArtifactsBasePath)} is required when using streaming publishing, but doesn't have a value set."); } return Log.HasLoggedErrors; }