From 48fa7eb5dd3aa79483eea17c34716c26c76d707d 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 dnceng - Alter the default permissions setup method to specify null permissions for dnceng. --- .../src/AzureDevOpsArtifactFeed.cs | 12 ++++++++++++ .../src/CreateAzureDevOpsFeed.cs | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs index 200b8adcbe3e..33800befdc87 100644 --- a/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs +++ b/src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs @@ -54,6 +54,18 @@ public AzureDevOpsArtifactFeed(string name, string organization, string project) throw new NotImplementedException($"Project '{project}' within organization '{organization}' contains no feed permissions information."); } break; + case "dnceng-stage": + // Use the default permissions for dnceng-stage + switch (project) + { + case "public": + case "internal": + Permissions = null; + break; + default: + throw new NotImplementedException($"Project '{project}' within organization '{organization}' contains no feed permissions information."); + } + break; default: throw new NotImplementedException($"Organization '{organization}' contains no feed permissions information."); diff --git a/src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs b/src/Microsoft.DotNet.Build.Tasks.Feed/src/CreateAzureDevOpsFeed.cs index 49032c553502..50ca59f32a85 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; @@ -194,6 +193,7 @@ private string GetFeedVisibilityTag(string organization, string project) switch (organization) { case "dnceng": + case "dnceng-stage": switch (project) { case "internal":