Skip to content

Commit 5d2b9c1

Browse files
premundkurepaadamzip
authored
[Rollout] Production rollout 2025-05-21 (#4857)
#4856 --------- Co-authored-by: Djuradj Kurepa <91743470+dkurepa@users.noreply.github.com> Co-authored-by: Adam <adamzippor@microsoft.com>
2 parents 7126d7c + 5e0ce7e commit 5d2b9c1

File tree

9 files changed

+173
-137
lines changed

9 files changed

+173
-137
lines changed

src/Microsoft.DotNet.Darc/DarcLib/GitHubClient.cs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,61 +1099,6 @@ private async Task<TreeResponse> GetTreeForPathAsync(string owner, string repo,
10991099
}
11001100
}
11011101

1102-
private async Task GetCommitMapForPathAsync(
1103-
string repoUri,
1104-
string branch,
1105-
string assetsProducedInCommit,
1106-
List<GitFile> files,
1107-
string pullRequestBaseBranch,
1108-
string path = "eng/common/")
1109-
{
1110-
if (path.EndsWith("/"))
1111-
{
1112-
path = path.Substring(0, path.Length - 1);
1113-
}
1114-
1115-
_logger.LogInformation(
1116-
$"Getting the contents of file/files in '{path}' of repo '{repoUri}' at commit '{assetsProducedInCommit}'");
1117-
1118-
(string owner, string repo) = ParseRepoUri(repoUri);
1119-
List<GitHubContent>? contents;
1120-
1121-
using (HttpResponseMessage response = await ExecuteRemoteGitCommandAsync(
1122-
HttpMethod.Get,
1123-
$"https://github.com/{owner}/{repo}",
1124-
$"repos/{owner}/{repo}/contents/{path}?ref={assetsProducedInCommit}",
1125-
_logger))
1126-
{
1127-
contents = JsonConvert.DeserializeObject<List<GitHubContent>>(await response.Content.ReadAsStringAsync());
1128-
}
1129-
1130-
foreach (GitHubContent content in contents!)
1131-
{
1132-
if (content.Type == GitHubContentType.File)
1133-
{
1134-
if (!DependencyFileManager.DependencyFiles.Contains(content.Path))
1135-
{
1136-
string fileContent = await GetFileContentsAsync(owner, repo, content.Path);
1137-
var gitCommit = new GitFile(content.Path, fileContent);
1138-
files.Add(gitCommit);
1139-
}
1140-
}
1141-
else
1142-
{
1143-
await GetCommitMapForPathAsync(
1144-
repoUri,
1145-
branch,
1146-
assetsProducedInCommit,
1147-
files,
1148-
pullRequestBaseBranch,
1149-
content.Path);
1150-
}
1151-
}
1152-
1153-
_logger.LogInformation(
1154-
$"Getting the contents of file/files in '{path}' of repo '{repoUri}' at commit '{assetsProducedInCommit}' succeeded!");
1155-
}
1156-
11571102
/// <summary>
11581103
/// Parse out the owner and repo from a repository url
11591104
/// </summary>

src/Microsoft.DotNet.Darc/DarcLib/Helpers/GitRepoUrlUtils.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,14 @@ public static string GetRepoFileAtCommitUri(string repoUri, string commit, strin
138138
_ => throw new ArgumentException("Unknown git repository type", nameof(repoUri)),
139139
};
140140

141+
public static string GetVmrFileAtCommitUri(string vmrUri, string productDirectory, string commit, string filePath)
142+
=> ParseTypeFromUri(vmrUri) switch
143+
{
144+
GitRepoType.AzureDevOps => $"{vmrUri}?version=GC{commit}&path=src/{productDirectory}/{filePath}",
145+
GitRepoType.GitHub => $"{vmrUri}/blob/{commit}/src/{productDirectory}/{filePath}",
146+
_ => throw new ArgumentException("Unknown git repository type", nameof(vmrUri)),
147+
};
148+
141149
public static string GetRepoFileAtBranchUri(string repoUri, string branch, string filePath)
142150
=> ParseTypeFromUri(repoUri) switch
143151
{
@@ -146,6 +154,14 @@ public static string GetRepoFileAtBranchUri(string repoUri, string branch, strin
146154
_ => throw new ArgumentException("Unknown git repository type", nameof(repoUri))
147155
};
148156

157+
public static string GetVmrFileAtBranchUri(string vmrUri, string productDirectory, string branch, string filePath)
158+
=> ParseTypeFromUri(vmrUri) switch
159+
{
160+
GitRepoType.AzureDevOps => $"{vmrUri}?version=GB{branch}&path=src/{productDirectory}/{filePath}",
161+
GitRepoType.GitHub => $"{vmrUri}/blob/{branch}/src/{productDirectory}/{filePath}",
162+
_ => throw new ArgumentException("Unknown git repository type", nameof(vmrUri))
163+
};
164+
149165
public static string GetRepoNameWithOrg(string uri)
150166
{
151167
var (repo, org) = GetRepoNameAndOwner(uri);

src/Microsoft.DotNet.Darc/DarcLib/Local.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,14 @@ public async Task UpdateDependenciesAsync(List<DependencyDetail> dependencies, I
102102
// so we need to strip the src/arcade prefix from the file paths.
103103
if (repoIsVmr)
104104
{
105-
engCommonFiles = engCommonFiles.Select(f => new GitFile(f.FilePath.Replace("src/arcade/", null), f.Content)).ToList();
105+
engCommonFiles = engCommonFiles
106+
.Select(f => new GitFile(
107+
f.FilePath.Replace("src/arcade/", null),
108+
f.Content,
109+
f.ContentEncoding,
110+
f.Mode,
111+
f.Operation))
112+
.ToList();
106113
}
107114

108115
filesToUpdate.AddRange(engCommonFiles);

src/ProductConstructionService/ProductConstructionService.BarViz/Pages/Codeflows.razor

Lines changed: 55 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@
2525
color: var(--neutral-foreground-hint) !important;
2626
font-style: italic;
2727
}
28+
29+
.commitSha {
30+
border: none;
31+
color: #888;
32+
font-family: monospace;
33+
font-size: 0.8em;
34+
top: -4px;
35+
position: relative;
36+
margin-left: 5px;
37+
margin-right: 7px;
38+
}
39+
40+
.commitSha a {
41+
height: 23px;
42+
padding: 2px 6px 0px 6px;
43+
}
44+
2845
</style>
2946

3047
<PageTitle>Codeflows – Maestro++</PageTitle>
@@ -47,6 +64,7 @@
4764
AutoFit="true"
4865
TGridItem=CodeflowSubscription
4966
ResizableColumns="true"
67+
ShowHover="true"
5068
RowClass="@(sub => sub.Enabled ? null : "disabled-subscription")"
5169
Style="width: 100%">
5270
<EmptyContent>
@@ -65,30 +83,50 @@
6583
<TemplateColumn Title="Backflow"
6684
Sortable="true"
6785
SortBy="@SortBy(sub => sub.BackflowSubscription != null && sub.BackflowSubscription.LastAppliedBuild != null ? sub.BackflowSubscription.LastAppliedBuild.DateProduced.ToString("o") : "1900")"
68-
Align="Align.Center">
86+
Align="Align.Start">
6987
<FluentLabel Title="@(context.BackflowSubscription?.LastAppliedBuild?.DateProduced.ToString("f"))">
70-
@(GetLastAppliedBuildTimeAgo(context.BackflowSubscription))
88+
@if (context.BackflowSubscription?.LastAppliedBuild != null)
89+
{
90+
@(GetLastAppliedBuildTimeAgo(context.BackflowSubscription))
91+
<FluentAnchor Href="@context.BackflowSubscription.LastAppliedBuild.GetCommitLink()" Target="_blank" class="commitSha" title="@context.BackflowSubscription.LastAppliedBuild.Commit">
92+
&commat;@GetShortSha(context.BackflowSubscription.LastAppliedBuild.Commit)
93+
</FluentAnchor>
94+
}
95+
else
96+
{
97+
<span>—</span>
98+
}
99+
71100
@if (context.BackflowPr != null)
72101
{
73-
<span> / </span>
74102
<FluentAnchor Href="@context.BackflowPr" Target="_blank" Appearance="Appearance.Hypertext">Active PR</FluentAnchor>
75103
}
76104
</FluentLabel>
77105
</TemplateColumn>
78106
<TemplateColumn Title="Forward flow"
79107
Sortable="true"
80108
SortBy="@SortBy(sub => sub.ForwardflowSubscription != null && sub.ForwardflowSubscription.LastAppliedBuild != null ? sub.ForwardflowSubscription.LastAppliedBuild.DateProduced.ToString("o") : "1900")"
81-
Align="Align.Center">
109+
Align="Align.Start">
82110
<FluentLabel Title="@(context.ForwardflowSubscription?.LastAppliedBuild?.DateProduced.ToString("f"))">
83-
@(GetLastAppliedBuildTimeAgo(context.ForwardflowSubscription))
111+
@if (context.ForwardflowSubscription?.LastAppliedBuild != null)
112+
{
113+
@(GetLastAppliedBuildTimeAgo(context.ForwardflowSubscription))
114+
<FluentAnchor Href="@context.ForwardflowSubscription.LastAppliedBuild.GetCommitLink()" Target="_blank" class="commitSha" title="@context.ForwardflowSubscription.LastAppliedBuild.Commit">
115+
&commat;@GetShortSha(context.ForwardflowSubscription.LastAppliedBuild.Commit)
116+
</FluentAnchor>
117+
}
118+
else
119+
{
120+
<span>—</span>
121+
}
122+
84123
@if (context.ForwardflowPr != null)
85124
{
86-
<span> / </span>
87125
<FluentAnchor Href="@context.ForwardflowPr" Target="_blank" Appearance="Appearance.Hypertext">Active PR</FluentAnchor>
88126
}
89127
</FluentLabel>
90128
</TemplateColumn>
91-
<TemplateColumn Style="width:60px">
129+
<TemplateColumn Width="60px">
92130
<CodeflowContextMenu Codeflow="@context" ShowDetails="@ShowDetails" />
93131
</TemplateColumn>
94132
</ChildContent>
@@ -143,21 +181,22 @@
143181
// Get all unique mappings
144182
var allMappings = subscriptions
145183
.Select(s => s.SourceDirectory ?? s.TargetDirectory)
146-
.Distinct();
184+
.Where(s => !string.IsNullOrEmpty(s))
185+
.Distinct()
186+
.ToList();
147187

148-
List<CodeflowSubscription> codeflows = new List<CodeflowSubscription>(allMappings.Count());
188+
List<CodeflowSubscription> codeflows = new List<CodeflowSubscription>(allMappings.Count);
149189
foreach (var mapping in allMappings)
150190
{
151-
var backflowSubscription = Subscriptions!.FirstOrDefault(s => s.SourceDirectory == mapping);
152-
var forwardflowSubscription = Subscriptions!.FirstOrDefault(s => s.TargetDirectory == mapping);
191+
var backflowSubscription = subscriptions!.FirstOrDefault(s => s.SourceDirectory == mapping);
192+
var forwardflowSubscription = subscriptions!.FirstOrDefault(s => s.TargetDirectory == mapping);
153193
PullRequests.TryGetValue(backflowSubscription?.Id ?? default, out var backflowPr);
154194
PullRequests.TryGetValue(forwardflowSubscription?.Id ?? default, out var forwardflowPr);
155195
codeflows.Add(new CodeflowSubscription(
156-
RepositoryUrl: backflowSubscription?.TargetRepository ?? forwardflowSubscription?.SourceRepository
157-
?? throw new InvalidOperationException(),
196+
RepositoryUrl: backflowSubscription?.TargetRepository ?? forwardflowSubscription?.SourceRepository!,
158197
RepositoryBranch: backflowSubscription?.TargetBranch,
159198
MappingName: mapping,
160-
Enabled: backflowSubscription?.Enabled ?? forwardflowSubscription?.Enabled ?? false, // TODO
199+
Enabled: backflowSubscription?.Enabled ?? forwardflowSubscription?.Enabled ?? false,
161200
BackflowSubscription: backflowSubscription,
162201
ForwardflowSubscription: forwardflowSubscription,
163202
BackflowPr: backflowPr,
@@ -234,4 +273,6 @@
234273
}
235274
];
236275
}
276+
277+
static string GetShortSha(string sha) => sha.Substring(0, 7);
237278
}

src/ProductConstructionService/ProductConstructionService.BarViz/Pages/Subscriptions.razor

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,20 @@
144144
[SupplyParameterFromQuery(Name = "search")]
145145
private string? searchFilterQuery { get; set; }
146146

147+
[SupplyParameterFromQuery(Name = "showDisabled")]
148+
private string? showDisabledQuery { get; set; }
149+
147150
Dictionary<Guid, string> PullRequests = [];
148151
List<Subscription>? AllSubscriptions = null;
149152
IQueryable<Subscription>? FilteredSubscriptions;
150153
PaginationState Pagination = new() { ItemsPerPage = 25 };
151154
string SearchFilter = string.Empty;
152-
bool ShowDisabled = false;
155+
156+
bool ShowDisabled
157+
{
158+
get => !string.IsNullOrEmpty(showDisabledQuery) && bool.TryParse(showDisabledQuery, out var value) && value;
159+
set => showDisabledQuery = value.ToString();
160+
}
153161

154162
GridSort<Subscription> SortBy(Expression<Func<Subscription, string>> sorter)
155163
=> GridSort<Subscription>.ByAscending(sorter);
@@ -197,7 +205,7 @@
197205
filteredSubscriptions = filteredSubscriptions?
198206
.Where(sub => searchTerms.All(term => IsMatch(sub, term)));
199207

200-
UpdateQueryParams(SearchFilter);
208+
UpdateQueryParams();
201209
}
202210
}
203211

@@ -208,6 +216,7 @@
208216
void SetDisabled(bool value)
209217
{
210218
ShowDisabled = value;
219+
UpdateQueryParams();
211220
FilterSubscriptions();
212221
}
213222

@@ -248,11 +257,12 @@
248257
await DialogService.ShowDialogAsync<SubscriptionDetailDialog>(subscription, parameters);
249258
}
250259

251-
private void UpdateQueryParams(string searchFilter)
260+
private void UpdateQueryParams()
252261
{
253262
var newUri = NavManager.GetUriWithQueryParameters(new Dictionary<string, object?>
254263
{
255-
["search"] = searchFilter,
264+
["search"] = SearchFilter,
265+
["showDisabled"] = ShowDisabled,
256266
});
257267

258268
NavManager.NavigateTo(newUri);

src/ProductConstructionService/ProductConstructionService.DependencyFlow/PullRequestConflictNotifier.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ public async Task NotifyAboutConflictingUpdateAsync(
6666
foreach (var file in conflictException.FilesInConflict)
6767
{
6868
var sourceString = subscription.IsBackflow()
69-
? $"[🔍 view in VMR]({GitRepoUrlUtils.GetRepoFileAtCommitUri(update.SourceRepo, update.SourceSha, file)})"
70-
: $"[🔍 view in {GitRepoUrlUtils.GetRepoNameWithOrg(update.SourceRepo)}]({GitRepoUrlUtils.GetRepoFileAtCommitUri(update.SourceRepo, update.SourceSha, file)})";
69+
? $"[🔍 View in VMR]({GitRepoUrlUtils.GetVmrFileAtCommitUri(update.SourceRepo, subscription.TargetDirectory, update.SourceSha, file)})"
70+
: $"[🔍 View in {GitRepoUrlUtils.GetRepoNameWithOrg(update.SourceRepo)}]({GitRepoUrlUtils.GetRepoFileAtCommitUri(update.SourceRepo, update.SourceSha, file)})";
7171
var targetString = subscription.IsBackflow()
72-
? $"[🔍 view in {GitRepoUrlUtils.GetRepoNameWithOrg(subscription.TargetRepository)}]({GitRepoUrlUtils.GetRepoFileAtBranchUri(subscription.TargetRepository, subscription.TargetBranch, file)})"
73-
: $"[🔍 view in VMR]({GitRepoUrlUtils.GetRepoFileAtBranchUri(subscription.TargetRepository, subscription.TargetBranch, file)})";
72+
? $"[🔍 View in {GitRepoUrlUtils.GetRepoNameWithOrg(subscription.TargetRepository)}]({GitRepoUrlUtils.GetRepoFileAtBranchUri(subscription.TargetRepository, subscription.TargetBranch, file)})"
73+
: $"[🔍 View in VMR]({GitRepoUrlUtils.GetVmrFileAtBranchUri(subscription.TargetRepository, subscription.SourceDirectory, subscription.TargetBranch, file)})";
7474
sb.AppendLine($" - `{file}` - {sourceString} / {targetString}");
7575
}
7676
sb.AppendLine();

0 commit comments

Comments
 (0)