From c2c31d74a765c28a9838829d80cd574d1c4cc965 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Wed, 8 Jul 2020 03:54:04 -0700 Subject: [PATCH 1/5] Fix time zone bug --- .../RolloutScorerAzureFunction/RolloutScorerFunction.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs b/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs index ef72a482e..a171c4da8 100644 --- a/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs +++ b/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs @@ -73,7 +73,8 @@ public static async Task Run([TimerTrigger("0 0 0 * * *")]TimerInfo myTimer, ILo RolloutScorer.RolloutScorer rolloutScorer = new RolloutScorer.RolloutScorer { Repo = deploymentGroup.Key, - RolloutStartDate = deploymentGroup.First().Started.GetValueOrDefault().Date, + RolloutStartDate = deploymentGroup.First().Started.GetValueOrDefault().ToOffset(TimeSpan.FromHours(-1)), + RolloutEndDate = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-1)), RolloutWeightConfig = Configs.DefaultConfig.RolloutWeightConfig, GithubConfig = Configs.DefaultConfig.GithubConfig, Log = log, From 8d0785fab8614368606ed5f3a2e5273026ca6abb Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Wed, 8 Jul 2020 05:17:00 -0700 Subject: [PATCH 2/5] whoops correction is in the wrong spot; let's fix that --- src/RolloutScorer/RolloutScorer/RolloutScorer.cs | 3 ++- .../RolloutScorerAzureFunction/RolloutScorerFunction.cs | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RolloutScorer/RolloutScorer/RolloutScorer.cs b/src/RolloutScorer/RolloutScorer/RolloutScorer.cs index e0ba3486b..688475a03 100644 --- a/src/RolloutScorer/RolloutScorer/RolloutScorer.cs +++ b/src/RolloutScorer/RolloutScorer/RolloutScorer.cs @@ -313,7 +313,8 @@ public async Task> GetRolloutIssuesFromGithubAsync() { SearchIssuesRequest searchIssuesRequest = new SearchIssuesRequest { - Created = new DateRange(RolloutStartDate, RolloutEndDate), + // use offsets here because the GitHub API gets mad about UTC specified with a + + Created = new DateRange(RolloutStartDate.ToOffset(TimeSpan.FromHours(-1)), RolloutEndDate.ToOffset(TimeSpan.FromHours(-1))), }; searchIssuesRequest.Repos.Add(GithubConfig.ScorecardsGithubOrg, GithubConfig.ScorecardsGithubRepo); diff --git a/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs b/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs index a171c4da8..40dd884d0 100644 --- a/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs +++ b/src/RolloutScorer/RolloutScorerAzureFunction/RolloutScorerFunction.cs @@ -73,8 +73,7 @@ public static async Task Run([TimerTrigger("0 0 0 * * *")]TimerInfo myTimer, ILo RolloutScorer.RolloutScorer rolloutScorer = new RolloutScorer.RolloutScorer { Repo = deploymentGroup.Key, - RolloutStartDate = deploymentGroup.First().Started.GetValueOrDefault().ToOffset(TimeSpan.FromHours(-1)), - RolloutEndDate = DateTimeOffset.Now.ToOffset(TimeSpan.FromHours(-1)), + RolloutStartDate = deploymentGroup.First().Started.GetValueOrDefault(), RolloutWeightConfig = Configs.DefaultConfig.RolloutWeightConfig, GithubConfig = Configs.DefaultConfig.GithubConfig, Log = log, From db766a0e36d30c0767df560b11043a4543fba815 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Wed, 8 Jul 2020 16:55:03 -0700 Subject: [PATCH 3/5] Switch to upgrading octokit package --- eng/Packages.props | 2 +- src/RolloutScorer/RolloutScorer/RolloutScorer.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/eng/Packages.props b/eng/Packages.props index 59b3fd0a5..ee5abb606 100644 --- a/eng/Packages.props +++ b/eng/Packages.props @@ -93,7 +93,7 @@ - + diff --git a/src/RolloutScorer/RolloutScorer/RolloutScorer.cs b/src/RolloutScorer/RolloutScorer/RolloutScorer.cs index 82c8703fd..8bb8d4ba1 100644 --- a/src/RolloutScorer/RolloutScorer/RolloutScorer.cs +++ b/src/RolloutScorer/RolloutScorer/RolloutScorer.cs @@ -216,6 +216,13 @@ public bool DetermineFailure() ScorecardBuildBreakdown lastBuild = BuildBreakdowns.Last(); Utilities.WriteDebug($"Last build is for {Repo} is {lastBuild.BuildSummary.BuildNumber} ({lastBuild.BuildSummary.WebLink})", Log, LogLevel); + + if (lastBuild.Score.Rollbacks == 1) + { + Utilities.WriteDebug($"Last build ({lastBuild.BuildSummary.BuildNumber}) was a rollback; rollout marked as FAILED.", Log, LogLevel); + return true; + } + string lastBuildResult = lastBuild.BuildSummary.Result; Utilities.WriteDebug($"Build {lastBuild.BuildSummary.BuildNumber} has result '{lastBuildResult}'", Log, LogLevel); switch (lastBuildResult) @@ -355,8 +362,7 @@ public async Task> GetRolloutIssuesFromGithubAsync() + $"from {RolloutStartDate} to {RolloutEndDate})", Log, LogLevel); SearchIssuesRequest searchIssuesRequest = new SearchIssuesRequest { - // use offsets here because the GitHub API gets mad about UTC specified with a + - Created = new DateRange(RolloutStartDate.ToOffset(TimeSpan.FromHours(-1)), RolloutEndDate.ToOffset(TimeSpan.FromHours(-1))), + Created = new DateRange(RolloutStartDate, RolloutEndDate), }; searchIssuesRequest.Repos.Add(GithubConfig.ScorecardsGithubOrg, GithubConfig.ScorecardsGithubRepo); From 0650c92eec9e42d4b2bbec679a3255ff9199fbc3 Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Thu, 16 Jul 2020 20:29:00 -0700 Subject: [PATCH 4/5] No issue tag necessary --- src/RolloutScorer/RolloutScorer/Utilities.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/RolloutScorer/RolloutScorer/Utilities.cs b/src/RolloutScorer/RolloutScorer/Utilities.cs index 3afa9bdb2..7b4462f97 100644 --- a/src/RolloutScorer/RolloutScorer/Utilities.cs +++ b/src/RolloutScorer/RolloutScorer/Utilities.cs @@ -26,7 +26,18 @@ public static bool IssueContainsRelevantLabels(Issue issue, string issueLabel, s WriteTrace($"Issue {issue.Number} has labels {string.Join(", ", issue.Labels.Select(l => $"'{l.Name}'"))}", log, logLevel); - bool isIssueLabel = issue.Labels.Any(l => l.Name == issueLabel) && issue.Labels.Any(l => l.Name == repoLabel); + bool isIssueLabel = false; + + if (issueLabel == GithubLabelNames.IssueLabel) + { + isIssueLabel = issue.Labels.Any(l => l.Name == repoLabel) + && !issue.Labels.Any(l => l.Name == GithubLabelNames.HotfixLabel || l.Name == GithubLabelNames.RollbackLabel || l.Name == GithubLabelNames.DowntimeLabel); + } + else + { + isIssueLabel = issue.Labels.Any(l => l.Name == issueLabel) && issue.Labels.Any(l => l.Name == repoLabel); + } + if (isIssueLabel) { WriteDebug($"Issue {issue.Number} determined to be {issueLabel} for {repoLabel}", log, logLevel); From 4e72f09013a2b2adcae5fe89c55dfacb651b0bde Mon Sep 17 00:00:00 2001 From: Jon Fortescue Date: Thu, 16 Jul 2020 20:51:00 -0700 Subject: [PATCH 5/5] revert package-lock.json --- src/Maestro/maestro-angular/package-lock.json | 36 ++++++++++++++----- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/src/Maestro/maestro-angular/package-lock.json b/src/Maestro/maestro-angular/package-lock.json index 1239a1e8d..cffb9b853 100644 --- a/src/Maestro/maestro-angular/package-lock.json +++ b/src/Maestro/maestro-angular/package-lock.json @@ -1576,6 +1576,7 @@ "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", "dev": true, + "optional": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -3105,7 +3106,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "constants-browserify": { "version": "1.0.0", @@ -3825,7 +3827,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true + "dev": true, + "optional": true }, "depd": { "version": "1.1.2", @@ -5433,6 +5436,7 @@ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz", "integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "inherits": "~2.0.0", @@ -5451,6 +5455,7 @@ "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, + "optional": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -5488,7 +5493,8 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", - "dev": true + "dev": true, + "optional": true }, "get-stream": { "version": "3.0.0", @@ -5737,7 +5743,8 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true + "dev": true, + "optional": true }, "has-value": { "version": "1.0.0", @@ -6567,7 +6574,8 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", - "dev": true + "dev": true, + "optional": true }, "is-windows": { "version": "1.0.2", @@ -7350,6 +7358,7 @@ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz", "integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", @@ -7362,7 +7371,8 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "dev": true, + "optional": true } } }, @@ -7640,7 +7650,8 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", "integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=", - "dev": true + "dev": true, + "optional": true }, "map-visit": { "version": "1.0.0", @@ -8297,6 +8308,7 @@ "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", "dev": true, + "optional": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -9556,6 +9568,7 @@ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz", "integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=", "dev": true, + "optional": true, "requires": { "load-json-file": "^1.0.0", "normalize-package-data": "^2.3.2", @@ -9567,6 +9580,7 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz", "integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "pify": "^2.0.0", @@ -9577,7 +9591,8 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true + "dev": true, + "optional": true } } }, @@ -9586,6 +9601,7 @@ "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz", "integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=", "dev": true, + "optional": true, "requires": { "find-up": "^1.0.0", "read-pkg": "^1.0.0" @@ -9596,6 +9612,7 @@ "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", "dev": true, + "optional": true, "requires": { "path-exists": "^2.0.0", "pinkie-promise": "^2.0.0" @@ -9606,6 +9623,7 @@ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", "dev": true, + "optional": true, "requires": { "pinkie-promise": "^2.0.0" } @@ -10980,6 +10998,7 @@ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", "dev": true, + "optional": true, "requires": { "is-utf8": "^0.2.0" } @@ -12493,6 +12512,7 @@ "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, + "optional": true, "requires": { "string-width": "^1.0.2 || 2" }