-
Notifications
You must be signed in to change notification settings - Fork 377
Fixup automatically created feed permissions #8037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f730ca6
Fixup automatically create feed permissions
mmitche 6f474ea
Respond to feedback
mmitche 5028cce
Respond to feedback
mmitche 85411fa
Switch back to setting org feed permissions explicitly instead of thr…
mmitche f4da5c3
Fix isolated feed issue
mmitche 796746e
Merge branch 'main' into fix-feed-perms
mmitche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
333 changes: 0 additions & 333 deletions
333
src/Microsoft.DotNet.Arcade.Sdk/tools/SdkTasks/SetupTargetFeeds.proj
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsArtifactFeed.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Microsoft.DotNet.Build.Tasks.Feed | ||
| { | ||
| /// <summary> | ||
| /// Represents the body of a request sent when creating a new feed. | ||
| /// </summary> | ||
| /// <remarks>> | ||
| /// When creating a new feed, we want to set up permissions based on the org and project. | ||
| /// Right now, only dnceng's public and internal projects are supported. | ||
| /// New feeds automatically get the feed administrators and project collection administrators as owners, | ||
| /// but we want to automatically add some additional permissions so that the build services can push to them, | ||
| /// and organization users can read from them. | ||
| /// | ||
| /// Note that there are two ways of providing read access to the feed: | ||
| /// 1. Providing explicit access in the permissions list to the "Project Collection Valid Users" | ||
| /// 2. Updating the Local feed view to allow 'collection' users access. | ||
| /// | ||
| /// The second is probably preferrable from a an AzDO pattern and usage standpoint. BUT the AzDO API has a drawback where | ||
| /// the create feed operation cannot create the local view with the appropriate access. Instead, it must be updated after the | ||
| /// feed is created. This would be fine except that updating a feed's permissions requires administrative permissions, while | ||
| /// creating a feed only requires contributor permissions. This would require passing around a PAT with management permissions, | ||
| /// instead of just r/w permissions, which is not ideal. | ||
| /// </remarks> | ||
| public class AzureDevOpsArtifactFeed | ||
| { | ||
| public AzureDevOpsArtifactFeed(string name, string organization, string project) | ||
| { | ||
| Name = name; | ||
| switch (organization) | ||
| { | ||
| case "dnceng": | ||
| switch (project) | ||
| { | ||
| case "public": | ||
| case "internal": | ||
| Permissions = new List<AzureDevOpsFeedPermission> | ||
| { | ||
| // Project Collection Build Service | ||
| new AzureDevOpsFeedPermission("Microsoft.TeamFoundation.ServiceIdentity;116cce53-b859-4624-9a95-934af41eccef:Build:7ea9116e-9fac-403d-b258-b31fcf1bb293", "contributor"), | ||
| // internal Build Service | ||
| new AzureDevOpsFeedPermission("Microsoft.TeamFoundation.ServiceIdentity;116cce53-b859-4624-9a95-934af41eccef:Build:b55de4ed-4b5a-4215-a8e4-0a0a5f71e7d8", "contributor"), | ||
| // Project administrators | ||
| new AzureDevOpsFeedPermission("Microsoft.TeamFoundation.Identity;S-1-9-1551374245-1349140002-2196814402-2899064621-3782482097-0-0-0-0-1", "administrator"), | ||
| // Project Collection value users (see class comment for info) | ||
| new AzureDevOpsFeedPermission("Microsoft.TeamFoundation.Identity;S-1-9-1551374245-3991166389-1514870082-2833517066-1601300440-0-0-0-0-3", "reader"), | ||
| }; | ||
| 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."); | ||
|
|
||
| } | ||
| } | ||
|
|
||
| public string Name { get; set; } | ||
|
|
||
| public List<AzureDevOpsFeedPermission> Permissions { get; private set; } | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
src/Microsoft.DotNet.Build.Tasks.Feed/src/AzureDevOpsFeedPermission.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Microsoft.DotNet.Build.Tasks.Feed | ||
| { | ||
| public class AzureDevOpsFeedPermission | ||
| { | ||
| public AzureDevOpsFeedPermission(string identityDescriptor, string role) | ||
| { | ||
| IdentityDescriptor = identityDescriptor; | ||
| Role = role; | ||
| } | ||
|
|
||
| public string IdentityDescriptor { get; set; } | ||
|
|
||
| public string Role { get; set; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.