Skip to content

Commit 85c32ae

Browse files
committed
Add workaround for grabbing the artifacts directly
1 parent b2ae40f commit 85c32ae

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

β€Žtracer/build/_build/Build.GitHub.csβ€Ž

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,15 +1042,28 @@ await client.Issue.Milestone.Update(
10421042
{
10431043
Logger.Information("Artifact not yet available (attempt {Attempt}/5)", attempt + 1);
10441044
}
1045+
catch (VssServiceException ex)
1046+
{
1047+
Logger.Information(ex, "Error looking up artifact (attempt {Attempt}/5)", attempt + 1);
1048+
}
10451049
}
10461050

1051+
string reportLink;
10471052
if (reportUrl is null)
10481053
{
1049-
throw new Exception("Could not resolve single-file report URL");
1054+
// Fall back to the build's artifacts page: not a direct link to the report, but it's
1055+
// deterministic, so we can always give people _some_ way to get to the full report.
1056+
var artifactsPageUrl = $"{AzureDevopsOrganisation}/{GitHubRepositoryName}/_build/results?buildId={AzureDevopsBuildId.Value}&view=artifacts&pathAsName=false&type=publishedArtifacts";
1057+
Logger.Warning("Could not resolve single-file report URL, linking to the build artifacts page instead");
1058+
reportLink = $"πŸ“„ **[Download the full report from the build artifacts β†’]({artifactsPageUrl})**";
1059+
}
1060+
else
1061+
{
1062+
var viewerUrl = $"https://andrewlock.github.io/merview/?zen=1&url={Uri.EscapeDataString(reportUrl)}";
1063+
reportLink = $"πŸ“„ **[View the full report (charts + all metrics) β†’]({viewerUrl})**";
10501064
}
10511065

1052-
var viewerUrl = $"https://andrewlock.github.io/merview/?zen=1&url={Uri.EscapeDataString(reportUrl)}";
1053-
var fullMarkdown = summaryMarkdown + $"\n\nπŸ“„ **[View the full report (charts + all metrics) β†’]({viewerUrl})**";
1066+
var fullMarkdown = summaryMarkdown + "\n\n" + reportLink;
10541067

10551068
Logger.Information("Updating PR comment on GitHub");
10561069
await ReplaceCommentInPullRequest(prNumber, "## Execution-Time Benchmarks Report", fullMarkdown);

0 commit comments

Comments
Β (0)