Skip to content

Commit 8f84b3f

Browse files
authored
[Rollout] Production rollout 2025-11-07 (#5442)
2 parents 56178de + 77427ef commit 8f84b3f

File tree

38 files changed

+1437
-283
lines changed

38 files changed

+1437
-283
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<#
2+
.SYNOPSIS
3+
Assigns a given Managed Identity (MI) a role in the Maestro application.
4+
#>
5+
6+
[CmdletBinding()]
7+
param(
8+
[Parameter(Mandatory = $true)]
9+
[string]$SubscriptionId,
10+
11+
[Parameter(Mandatory = $true)]
12+
[string]$ResourceGroupName,
13+
14+
[Parameter(Mandatory = $true)]
15+
[string]$ManagedIdentityName,
16+
17+
[Parameter(Mandatory = $false)]
18+
[string]$AppServicePrincipal = "caf36d9b-2940-4270-9a1d-c494eda6ea18", # PROD Maestro application object ID
19+
20+
[Parameter(Mandatory = $false)]
21+
[ValidateSet("user", "admin")]
22+
[string]$Role = "user"
23+
)
24+
25+
# Set app role ID based on role parameter (get it from the JSON manifest of the Maestro application in Azure AD)
26+
$appRoleId = switch ($Role) {
27+
"user" { "108187e7-df11-4592-b306-2a2a0b15d8f0" } # User role ID
28+
"admin" { "8b5767ed-0675-4e95-9858-f9851b884345" } # Admin role ID
29+
}
30+
31+
Write-Host "Using role: $Role (ID: $appRoleId)"
32+
33+
az login
34+
35+
$resourceIdWithManagedIdentity = "/subscriptions/$SubscriptionId/resourceGroups/$ResourceGroupName/providers/Microsoft.ManagedIdentity/userAssignedIdentities/$ManagedIdentityName"
36+
$principalId = (az identity show --resource-group $ResourceGroupName --name $ManagedIdentityName --subscription $SubscriptionId --query 'principalId' -o tsv)
37+
Write-Host "Managed identity principal ID: $($principalId)"
38+
39+
$body = "{'principalId': '$principalId', 'resourceId': '$($appServicePrincipal)', 'appRoleId': '$($appRoleId)'}"
40+
Write-Host "Body: $body"
41+
42+
az rest -m POST -u https://graph.microsoft.com/v1.0/servicePrincipals/$principalId/appRoleAssignments -b $body

src/Maestro/Maestro.MergePolicies/CodeFlowMergePolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The following error(s) were encountered:
3131
3232
The `{VmrInfo.DefaultRelativeSourceManifestPath}` and `{VersionFiles.VersionDetailsXml}` files are managed by Maestro/darc. Outside of exceptional circumstances, these files should not be modified manually.
3333
**Unless you are sure that you know what you are doing, we recommend reaching out for help**. You can receive assistance by:
34-
- tagging the **@dotnet/product-construction** team in a PR comment
34+
- tagging the **@dotnet/prodconsvcs** team in a PR comment
3535
- using the [First Responder channel](https://teams.microsoft.com/l/channel/19%3Aafba3d1545dd45d7b79f34c1821f6055%40thread.skype/First%20Responders?groupId=4d73664c-9f2f-450d-82a5-c2f02756606dhttps://teams.microsoft.com/l/channel/19%3Aafba3d1545dd45d7b79f34c1821f6055%40thread.skype/First%20Responders?groupId=4d73664c-9f2f-450d-82a5-c2f02756606d),
3636
- [opening an issue](https://github.com/dotnet/arcade-services/issues/new?template=BLANK_ISSUE) in the dotnet/arcade-services repo
3737
- contacting the [.NET Product Construction Services team via e-mail](mailto:[email protected]).

src/Microsoft.DotNet.Darc/Darc/Operations/VirtualMonoRepo/BackflowOperation.cs

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
using Microsoft.DotNet.Darc.Options.VirtualMonoRepo;
99
using Microsoft.DotNet.DarcLib;
1010
using Microsoft.DotNet.DarcLib.Helpers;
11-
using Microsoft.DotNet.DarcLib.Models.VirtualMonoRepo;
1211
using Microsoft.DotNet.DarcLib.VirtualMonoRepo;
13-
using Microsoft.DotNet.ProductConstructionService.Client.Models;
1412
using Microsoft.Extensions.Logging;
1513

1614
#nullable enable
@@ -19,6 +17,7 @@ namespace Microsoft.DotNet.Darc.Operations.VirtualMonoRepo;
1917
internal class BackflowOperation(
2018
BackflowCommandLineOptions options,
2119
IVmrInfo vmrInfo,
20+
IVmrForwardFlower forwardFlower,
2221
IVmrBackFlower backFlower,
2322
IBackflowConflictResolver backflowConflictResolver,
2423
IVmrCloneManager vmrCloneManager,
@@ -29,73 +28,40 @@ internal class BackflowOperation(
2928
IProcessManager processManager,
3029
IFileSystem fileSystem,
3130
ILogger<BackflowOperation> logger)
32-
: CodeFlowOperation(options, vmrInfo, vmrCloneManager, dependencyTracker, dependencyFileManager, localGitRepoFactory, barApiClient, fileSystem, logger)
31+
: CodeFlowOperation(options, forwardFlower, backFlower, backflowConflictResolver, vmrInfo, vmrCloneManager, dependencyTracker, dependencyFileManager, localGitRepoFactory, barApiClient, fileSystem, logger)
3332
{
3433
private readonly BackflowCommandLineOptions _options = options;
3534
private readonly IVmrInfo _vmrInfo = vmrInfo;
36-
private readonly IVmrBackFlower _backFlower = backFlower;
37-
private readonly IBackflowConflictResolver _backflowConflictResolver = backflowConflictResolver;
3835
private readonly IProcessManager _processManager = processManager;
36+
private readonly ILocalGitRepoFactory _localGitRepoFactory = localGitRepoFactory;
3937

4038
protected override async Task ExecuteInternalAsync(
4139
string repoName,
4240
string? targetDirectory,
4341
IReadOnlyCollection<AdditionalRemote> additionalRemotes,
4442
CancellationToken cancellationToken)
4543
{
44+
4645
if (string.IsNullOrEmpty(targetDirectory))
4746
{
4847
throw new DarcException("Please specify path to a local repository to flow to");
4948
}
5049

51-
_vmrInfo.VmrPath = new NativePath(_options.VmrPath ?? _processManager.FindGitRoot(Environment.CurrentDirectory));
50+
var vmrPath = new NativePath(_options.VmrPath ?? _processManager.FindGitRoot(Environment.CurrentDirectory));
5251
var targetRepoPath = new NativePath(_processManager.FindGitRoot(targetDirectory));
5352

53+
_vmrInfo.VmrPath = vmrPath;
54+
55+
var vmr = _localGitRepoFactory.Create(vmrPath);
56+
57+
var build = await GetOrCreateBuildAsync(vmr, _options.Build);
58+
5459
await FlowCodeLocallyAsync(
5560
targetRepoPath,
5661
isForwardFlow: false,
5762
additionalRemotes,
63+
build,
64+
subscription: null,
5865
cancellationToken);
5966
}
60-
61-
protected override async Task<bool> FlowCodeAsync(
62-
ILocalGitRepo productRepo,
63-
Build build,
64-
Codeflow currentFlow,
65-
SourceMapping mapping,
66-
string headBranch,
67-
IReadOnlyList<string> excludedAssets,
68-
CancellationToken cancellationToken)
69-
{
70-
LastFlows lastFlows = await _backFlower.GetLastFlowsAsync(
71-
mapping.Name,
72-
productRepo,
73-
currentIsBackflow: true);
74-
75-
try
76-
{
77-
var result = await _backFlower.FlowBackAsync(
78-
mapping.Name,
79-
productRepo.Path,
80-
build,
81-
excludedAssets: excludedAssets,
82-
headBranch,
83-
headBranch,
84-
enableRebase: true,
85-
forceUpdate: true,
86-
cancellationToken);
87-
88-
return result.HadUpdates;
89-
}
90-
finally
91-
{
92-
await _backflowConflictResolver.TryMergingBranchAndUpdateDependencies(
93-
new CodeflowOptions(mapping, currentFlow, headBranch, headBranch, build, excludedAssets, true, false),
94-
lastFlows,
95-
productRepo,
96-
headBranch,
97-
headBranchExisted: true,
98-
cancellationToken);
99-
}
100-
}
10167
}

0 commit comments

Comments
 (0)