From c0c54f6587134bf568d7f7561a810f69ce2dbb8c Mon Sep 17 00:00:00 2001 From: Matt Mitchell Date: Thu, 21 Oct 2021 21:31:08 -0700 Subject: [PATCH] Fix feed creation for dnceng-stage and staging scenarios - Don't call GetFeedVisibilityTag when the feed name is explicitly specified - Alter GetFeedVisibilityTag to support non-dnceng - Alter the default permissions setup method to specify null permissions for non-dnceng --- .../src/AzureDevOpsArtifactFeed.cs | 4 +++- .../src/CreateAzureDevOpsFeed.cs | 5 ++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs index 200b8adcbe3..58efcc50e38 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs @@ -55,7 +55,9 @@ public AzureDevOpsArtifactFeed(string name, string organization, string project) } break; default: - throw new NotImplementedException($"Organization '{organization}' contains no feed permissions information."); + // Use the default permissions + Permissions = null; + break; } } diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs index 49032c55350..3c53d6da07f 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs @@ -104,9 +104,8 @@ private async Task ExecuteAsync() // 1. In nuget.config files (and elsewhere), the name at a glance can identify its visibility // 2. Existing automation has knowledge of "darc-int" and "darc-pub" for purposes of injecting authentication for internal builds // and managing the isolated feeds within the NuGet.config files. - string accessTag = GetFeedVisibilityTag(AzureDevOpsOrg, AzureDevOpsProject); string extraContentInfo = !string.IsNullOrEmpty(ContentIdentifier) ? $"-{ContentIdentifier}" : ""; - string baseFeedName = FeedName ?? $"darc-{accessTag}{extraContentInfo}-{feedCompatibleRepositoryName}-{CommitSha.Substring(0, ShaUsableLength)}"; + string baseFeedName = FeedName ?? $"darc-{GetFeedVisibilityTag(AzureDevOpsOrg, AzureDevOpsProject)}{extraContentInfo}-{feedCompatibleRepositoryName}-{CommitSha.Substring(0, ShaUsableLength)}"; string versionedFeedName = baseFeedName; bool needsUniqueName = false; int subVersion = 0; @@ -204,7 +203,7 @@ private string GetFeedVisibilityTag(string organization, string project) throw new NotImplementedException($"Project '{project}' within organization '{organization}' has no visibility mapping."); } default: - throw new NotImplementedException($"Organization '{organization}' has no visibility mapping."); + return project.Substring(0, Math.Min(3, project.Length)); } } }