Skip to content

Commit dd73d1b

Browse files
dmitshurgopherbot
authored andcommitted
cmd/relui: fix up goimports regeneration task, add one-off workflow
CL 442157 added a task at the end of the major Go release workflow to mail a CL to x/tools. There were 3 new fields added to VersionTasks, but cmd/relui only set one of them, which caused the task not to work during the Go 1.20 release (go.dev/issue/58227). Due to an unrelated issue in cmd/relui (go.dev/issue/58228), we didn't get the opportunity to fix up the task and restart it, so it was skipped. Set the 2 missing fields in cmd/relui, and add a temporary workflow to trigger (and test out) the new functionality after the Go 1.20 release. Also apply a few minor refinements to CreateUpdateStdlibIndexCL. Remove the unused branch parameter, and avoid GetCurrentMajor to determine the current major version. GetCurrentMajor will change its report from N to N+1 sometime during the major Go release, after the tags are published. We already know the major version in the workflow. Fixes golang/go#58227. For golang/go#54377. Change-Id: I6377cdf051e4ea8628a88ac3f7eaf70651b34f72 Reviewed-on: https://go-review.googlesource.com/c/build/+/464815 Reviewed-by: Carlos Amedee <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent a979ae3 commit dd73d1b

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

cmd/relui/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,11 @@ func main() {
193193
ApproveAction: relui.ApproveActionDep(dbPool),
194194
}
195195
versionTasks := &task.VersionTasks{
196-
Gerrit: gerritClient,
197-
GoProject: "go",
198-
CreateBuildlet: coordinator.CreateBuildlet,
196+
Gerrit: gerritClient,
197+
GerritURL: "https://go.googlesource.com",
198+
GoProject: "go",
199+
CreateBuildlet: coordinator.CreateBuildlet,
200+
LatestGoBinaries: task.LatestGoBinaries,
199201
}
200202
if err := relui.RegisterReleaseWorkflows(ctx, dh, buildTasks, milestoneTasks, versionTasks, commTasks); err != nil {
201203
log.Fatalf("RegisterReleaseWorkflows: %v", err)

internal/relui/workflows.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,18 @@ func RegisterReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *B
256256
h.RegisterDefinition("pre-announce "+r.name, wd)
257257
}
258258

259+
// Register a one-off "update stdlib index CL"-only workflow for Go 1.20.
260+
// See go.dev/issue/58227 and go.dev/issue/58228 for context on why this is needed.
261+
{
262+
wd := wf.New()
263+
264+
coordinators := wf.Param(wd, releaseCoordinators)
265+
updateStdlibIndexCL := wf.Task2(wd, "Mail update stdlib index CL for 1.20", version.CreateUpdateStdlibIndexCL, coordinators, wf.Const("go1.20"))
266+
wf.Output(wd, "Stdlib regeneration CL", updateStdlibIndexCL)
267+
268+
h.RegisterDefinition("Mail CL to regenerate x/tools/internal/imports after 1.20 release", wd)
269+
}
270+
259271
// Register dry-run release workflows.
260272
registerBuildTestSignOnlyWorkflow(h, version, build, currentMajor+1, task.KindBeta)
261273

@@ -395,7 +407,7 @@ func addSingleReleaseWorkflow(
395407
pushed := wf.Action3(wd, "Push issues", milestone.PushIssues, milestones, nextVersion, kindVal, wf.After(tagged))
396408
versionPublished = wf.Task2(wd, "Publish to website", build.publishArtifacts, nextVersion, signedAndTestedArtifacts, wf.After(uploaded, pushed))
397409
if kind == task.KindMajor {
398-
updateStdlibIndexCL := wf.Task3(wd, fmt.Sprintf("Mail update stdlib index CL for 1.%d", major), version.CreateUpdateStdlibIndexCL, wf.Const("master"), coordinators, versionPublished)
410+
updateStdlibIndexCL := wf.Task2(wd, fmt.Sprintf("Mail update stdlib index CL for 1.%d", major), version.CreateUpdateStdlibIndexCL, coordinators, versionPublished)
399411
wf.Output(wd, "Stdlib regeneration CL", updateStdlibIndexCL)
400412
}
401413
wf.Output(wd, "Released version", versionPublished)

internal/task/tagx.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ func tgzToMap(r io.Reader) (map[string]string, error) {
441441
return result, nil
442442
}
443443

444+
// LatestGoBinaries returns a URL to the latest linux/amd64
445+
// Go distribution archive using the go.dev/dl/ JSON API.
444446
func LatestGoBinaries(ctx context.Context) (string, error) {
445447
resp, err := ctxhttp.Get(ctx, http.DefaultClient, "https://go.dev/dl/?mode=json")
446448
if err != nil {

internal/task/version.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ func (t *VersionTasks) TagRelease(ctx *workflow.TaskContext, version, commit str
143143
return t.Gerrit.Tag(ctx, t.GoProject, version, commit)
144144
}
145145

146-
func (t *VersionTasks) CreateUpdateStdlibIndexCL(ctx *workflow.TaskContext, branch string, reviewers []string, version string) (string, error) {
146+
func (t *VersionTasks) CreateUpdateStdlibIndexCL(ctx *workflow.TaskContext, reviewers []string, version string) (string, error) {
147147
var files = make(map[string]string) // Map key is relative path, and map value is file content.
148148

149149
binaries, err := t.LatestGoBinaries(ctx)
@@ -186,13 +186,9 @@ func (t *VersionTasks) CreateUpdateStdlibIndexCL(ctx *workflow.TaskContext, bran
186186
}
187187
files["internal/imports/zstdlib.go"] = tools["zstdlib.go"]
188188

189-
major, err := t.GetCurrentMajor(ctx)
190-
if err != nil {
191-
return "", err
192-
}
193189
changeInput := gerrit.ChangeInput{
194190
Project: "tools",
195-
Subject: fmt.Sprintf("internal/imports: update stdlib index for %v", major),
191+
Subject: fmt.Sprintf("internal/imports: update stdlib index for %s\n\nFor golang/go#38706.", strings.Replace(version, "go", "Go ", 1)),
196192
Branch: "master",
197193
}
198194
return t.Gerrit.CreateAutoSubmitChange(ctx, changeInput, reviewers, files)

0 commit comments

Comments
 (0)