internal/task: add support for okay-after-rc2 label

We've created an okay-after-rc2 label, which works like okay-after-rc1
but for RC 2 instead of RC 1. Make the 'Check blocking issues' task more
useful by having it ask only about release blockers that aren't already
marked up as being "okay to resolve before or after <this release>".

Change-Id: I8e5cc00dea7125915fc2151d4b3094625e2ade18
Reviewed-on: https://go-review.googlesource.com/c/build/+/797220
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/internal/task/milestones.go b/internal/task/milestones.go
index a2ed3c7..8f3f020 100644
--- a/internal/task/milestones.go
+++ b/internal/task/milestones.go
@@ -121,7 +121,8 @@
 		releaseBlocker := labels["release-blocker"]
 		switch {
 		case kind == KindBeta && strings.HasSuffix(version, "beta1") && labels["okay-after-beta1"],
-			kind == KindRC && strings.HasSuffix(version, "rc1") && labels["okay-after-rc1"]:
+			kind == KindRC && strings.HasSuffix(version, "rc1") && labels["okay-after-rc1"],
+			kind == KindRC && strings.HasSuffix(version, "rc2") && labels["okay-after-rc2"]:
 			releaseBlocker = false
 		}
 		if releaseBlocker {
@@ -216,6 +217,8 @@
 			removeLabel("okay-after-beta1")
 		} else if kind == KindRC && strings.HasSuffix(version, "rc1") {
 			removeLabel("okay-after-rc1")
+		} else if kind == KindRC && strings.HasSuffix(version, "rc2") {
+			removeLabel("okay-after-rc2")
 		} else if kind == KindMajor || kind == KindMinor {
 			newMilestone = &milestones.Next
 			actions = append(actions, fmt.Sprintf("pushed to milestone %d", milestones.Next))
diff --git a/internal/task/milestones_test.go b/internal/task/milestones_test.go
index a3e5d33..2d688de 100644
--- a/internal/task/milestones_test.go
+++ b/internal/task/milestones_test.go
@@ -63,6 +63,18 @@
 			version: "go1.20rc2", kind: KindRC,
 			want: errManualApproval,
 		},
+		{
+			name:    "RC 2 with one hard blocker",
+			issues:  map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
+			version: "go1.27rc2", kind: KindRC,
+			want: errManualApproval,
+		},
+		{
+			name:    "RC 2 with one blocker marked okay-after-rc2",
+			issues:  map[int]*github.Issue{123: {Labels: []*github.Label{{Name: github.String("release-blocker")}, {Name: github.String("okay-after-rc2")}}, Milestone: &github.Milestone{ID: github.Int64(1)}}},
+			version: "go1.27rc2", kind: KindRC,
+			want: nil, // Want no error.
+		},
 	} {
 		t.Run(tc.name, func(t *testing.T) {
 			tasks := &MilestoneTasks{