internal/task: add a step in pre-release to ask for user approval

A local relui screenshot is at https://go.dev/issue/57643#issuecomment-2305572494

For golang/go#57643

Change-Id: Iab10d6b4adbb04cfa8381d4e4776c3166ae40f41
Reviewed-on: https://go-review.googlesource.com/c/build/+/607896
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Hongxiang Jiang <hxjiang@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Commit-Queue: Hongxiang Jiang <hxjiang@golang.org>
This commit is contained in:
Hongxiang Jiang 2024-08-22 20:28:45 +00:00 коммит произвёл Gopher Robot
Родитель 29ddaf7047
Коммит cc9395c521
3 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -322,6 +322,7 @@ func main() {
CloudBuild: cloudBuildClient,
SendMail: mailFunc,
AnnounceMailHeader: goplsAnnMail,
ApproveAction: relui.ApproveActionDep(dbPool),
}
dh.RegisterDefinition("Prepare a pre-release gopls candidate", goplsTasks.NewPrereleaseDefinition())
dh.RegisterDefinition("Release gopls", goplsTasks.NewReleaseDefinition())

Просмотреть файл

@ -26,6 +26,7 @@ type ReleaseGoplsTasks struct {
CloudBuild CloudBuildClient
SendMail func(MailHeader, MailContent) error
AnnounceMailHeader MailHeader
ApproveAction func(*wf.TaskContext) error
}
// NewPrereleaseDefinition create a new workflow definition for gopls pre-release.
@ -39,8 +40,9 @@ func (r *ReleaseGoplsTasks) NewPrereleaseDefinition() *wf.Definition {
semv := wf.Task1(wd, "validating input version", r.isValidReleaseVersion, version)
prerelease := wf.Task1(wd, "find the pre-release version", r.nextPrerelease, semv)
approved := wf.Action2(wd, "wait for release coordinator approval", r.approveVersion, semv, prerelease)
issue := wf.Task1(wd, "create release git issue", r.createReleaseIssue, semv)
issue := wf.Task1(wd, "create release git issue", r.createReleaseIssue, semv, wf.After(approved))
branchCreated := wf.Action1(wd, "creating new branch if minor release", r.createBranchIfMinor, semv, wf.After(issue))
configChangeID := wf.Task3(wd, "updating branch's codereview.cfg", r.updateCodeReviewConfig, semv, reviewers, issue, wf.After(branchCreated))
@ -59,6 +61,11 @@ func (r *ReleaseGoplsTasks) NewPrereleaseDefinition() *wf.Definition {
return wd
}
func (r *ReleaseGoplsTasks) approveVersion(ctx *wf.TaskContext, semv semversion, pre string) error {
ctx.Printf("The next release candidate will be v%v.%v.%v-%s", semv.Major, semv.Minor, semv.Patch, pre)
return r.ApproveAction(ctx)
}
// createReleaseIssue attempts to locate the release issue associated with the
// given milestone. If no such issue exists, a new one is created.
//

Просмотреть файл

@ -659,7 +659,8 @@ esac`, tc.wantVersion)
1: fmt.Sprintf("gopls/v%v.%v.%v", tc.semv.Major, tc.semv.Minor, tc.semv.Patch),
},
},
SendMail: func(h MailHeader, c MailContent) error { return nil },
SendMail: func(h MailHeader, c MailContent) error { return nil },
ApproveAction: func(tc *workflow.TaskContext) error { return nil },
}
wd := tasks.NewPrereleaseDefinition()