Skip to content

Commit

Permalink
Rollout/2024 08 06 (#3789)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkurepa authored Aug 6, 2024
2 parents 91f5217 + 00c4879 commit a4ac286
Show file tree
Hide file tree
Showing 16 changed files with 524 additions and 21 deletions.
1 change: 1 addition & 0 deletions arcade-services.sln
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ Global
{37D70EEA-9621-44EB-921A-5D303917F851}.Release|x86.Build.0 = Release|Any CPU
{93F066A5-A2D8-4926-A255-81077AEE5972}.Debug|Any CPU.ActiveCfg = Debug|x64
{93F066A5-A2D8-4926-A255-81077AEE5972}.Debug|Any CPU.Build.0 = Debug|x64
{93F066A5-A2D8-4926-A255-81077AEE5972}.Debug|Any CPU.Deploy.0 = Debug|x64
{93F066A5-A2D8-4926-A255-81077AEE5972}.Debug|x64.ActiveCfg = Debug|x64
{93F066A5-A2D8-4926-A255-81077AEE5972}.Debug|x64.Build.0 = Debug|x64
{93F066A5-A2D8-4926-A255-81077AEE5972}.Debug|x64.Deploy.0 = Debug|x64
Expand Down
22 changes: 21 additions & 1 deletion src/Maestro/Maestro.Web/.config/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,25 @@
"SignedOutCallbackPath": "/signout-callback-oidc"
},
"GitDownloadLocation": "https://netcorenativeassets.blob.core.windows.net/resource-packages/external/windows/git/Git-2.32.0-64-bit.zip",
"EnableAutoBuildPromotion": "[config(FeatureManagement:AutoBuildPromotion)]"
"EnableAutoBuildPromotion": "[config(FeatureManagement:AutoBuildPromotion)]",
"DependencyFlowSLAs": {
"Repositories": {
"dotnet/arcade": {
"WarningUnconsumedBuildAge": 11,
"FailUnconsumedBuildAge": 14
},
"dotnet/source-build-externals": {
"WarningUnconsumedBuildAge": 11,
"FailUnconsumedBuildAge": 14
},
"dotnet/roslyn": {
"WarningUnconsumedBuildAge": 11,
"FailUnconsumedBuildAge": 14
},
"dotnet/extensions": {
"WarningUnconsumedBuildAge": 11,
"FailUnconsumedBuildAge": 14
}
}
}
}
6 changes: 6 additions & 0 deletions src/Maestro/Maestro.Web/Pages/DependencyFlow/GitHubInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Maestro.Web.Pages.DependencyFlow;

public record GitHubInfo(string Owner, string Repo);
119 changes: 119 additions & 0 deletions src/Maestro/Maestro.Web/Pages/DependencyFlow/Incoming.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
@page "/DependencyFlow/incoming/{channelId}/{owner}/{repo}"
@using Maestro.Web.Pages.DependencyFlow
@model IncomingModel

@{
ViewBag.Title = "DependencyFlow";
}

@section Head {
<style type="text/css">
/* Provide sufficient contrast against white background */
a {
color: #0366d6;
}
a.link-light {
color: #9FF
}
</style>
}

<small>For channel '@Model.ChannelName' based on <a href="@Model.GetCommitUrl(Model.Build)">@Model.GetGitHubInfo(Model.Build)?.Repo/@Model.Build?.GitHubBranch@@@Model.Build?.Commit.Substring(0, 6)</a> build <a href="@Model.GetBuildUrl(Model.Build)">@Model.Build?.AzureDevOpsBuildNumber</a> produced @Model.GetDateProduced(Model.Build)</small>

<div class="card-deck">
@{
var index = 0;
}

@foreach (var incoming in Model.IncomingRepositories?.OrderBy(r => r.ShortName).ToArray() ?? Array.Empty<IncomingRepo>())
{
// We compute the "condition" of a dependency by first checking how old the build we have is.
// If it's older than we'd like, we then ALSO check the number of commits that we're missing
// If it's old but there are few commits, it's OK, there just hasn't been churn
// If it's old and there are lots of commits, ruh-roh!
string conditionClass;
string textClass = "text-white";
string linkClass = "link-light";
string statusIcon = "✔️";

var elapsed = TimeSpan.Zero;
if (incoming.OldestPublishedButUnconsumedBuild != null)
{
elapsed = DateTime.UtcNow - incoming.OldestPublishedButUnconsumedBuild.DateProduced;
}

if (incoming.OldestPublishedButUnconsumedBuild == null || elapsed.TotalDays < Model.SlaOptions.GetForRepo(incoming.ShortName).WarningUnconsumedBuildAge)
{
conditionClass = "bg-primary";
}
else if (elapsed.TotalDays < Model.SlaOptions.GetForRepo(incoming.ShortName).FailUnconsumedBuildAge)
{
statusIcon = "";
conditionClass = "bg-warning";
textClass = null;
linkClass = null;
}
else
{
statusIcon = "";
conditionClass = "bg-danger";
}

<div class="card @textClass @conditionClass m-1">
<div class="card-header">@incoming.ShortName</div>
<div class="card-body">
<h5 class="card-title">
@statusIcon We are @(incoming.CommitDistance == null ? "(unknown)" : incoming.CommitDistance == 0 ? "0" : $"{incoming.CommitDistance}") commit(s) behind
</h5>
<p class="card-text">
Oldest unconsumed - build: @(incoming.OldestPublishedButUnconsumedBuild == null ? "none" : incoming.OldestPublishedButUnconsumedBuild.DateProduced.Humanize()) / commit: @(incoming.CommitAge == null ? "(unknown)" : incoming.CommitAge.Humanize())
</p>
</div>
<div class="card-footer">
<a class="@linkClass" target="_blank" href="@incoming.BuildUrl">Build @incoming.LastConsumedBuild.AzureDevOpsBuildNumber</a> | <a class="@linkClass" target="_blank" href="@incoming.CommitUrl">@incoming.LastConsumedBuild.Commit.Substring(0, 6)</a>
</div>
</div>

index += 1;
if (index % 3 == 0)
{
// Wrap every 3 cards
<div class="w-100"></div>
}
}
</div>

<small>Rate Limit Remaining: @GetRateLimitInfo(Model.CurrentRateLimit) | @GetBuildInfo()</small>

@functions
{
string DisplayFor(string repository)
{
return repository.Substring("https://github.com/".Length);
}

string GetBuildInfo()
{
if (Program.SourceVersion == null)
{
return "Local build";
}

var branch = Program.SourceBranch ?? "unknown";

if (branch.StartsWith("refs/heads/"))
branch = branch.Substring("refs/heads/".Length);

var sha = Program.SourceVersion?.Substring(0, 6);
return $"Built for branch {branch}@{sha}";
}

string GetRateLimitInfo(Octokit.RateLimit rateLimit)
{
return rateLimit == null
? "unknown"
: $"{rateLimit.Remaining}(Resets {rateLimit.Reset.Humanize()})";
}
}
Loading

0 comments on commit a4ac286

Please sign in to comment.