Skip to content

Commit d68d7d9

Browse files
dmitshurgopherbot
authored andcommitted
cmd/relui: add communication tasks to the end of release workflows
The comm tasks proved to work well during the last release, so take the next step of merging them into the main release workflow. This moves in the direction of a Go release being fully completed by a relui workflow, with all information necessary for the release automation to do its job provided upfront. For short term flexibility, keep the comm-less release workflows around under a "[without comms]" prefix, so they're there without redeployment. Balance it out by deleting the announce-only and tweet-only workflows since those are the least useful by now. For golang/go#53537. Change-Id: I82af660c31ceb0045c953adbba9401c38245d4c0 Reviewed-on: https://go-review.googlesource.com/c/build/+/419515 Run-TryBot: Dmitri Shuralyov <[email protected]> Reviewed-by: Javad Rajabzadeh <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent f234a3e commit d68d7d9

File tree

2 files changed

+32
-206
lines changed

2 files changed

+32
-206
lines changed

cmd/relui/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@ func main() {
115115
dh := relui.NewDefinitionHolder()
116116
relui.RegisterMailDLCLDefinition(dh, versionTasks)
117117
relui.RegisterCommunicationDefinitions(dh, commTasks)
118-
relui.RegisterAnnounceMailOnlyDefinitions(dh, commTasks.AnnounceMailTasks)
119-
relui.RegisterTweetOnlyDefinitions(dh, commTasks.TweetTasks)
120118
userPassAuth := buildlet.UserPass{
121119
Username: "user-relui",
122120
Password: key(*masterKey, "user-relui"),

internal/relui/workflows.go

Lines changed: 32 additions & 204 deletions
Original file line numberDiff line numberDiff line change
@@ -277,193 +277,6 @@ It shows up in the announcement mail.`,
277277
}
278278
)
279279

280-
// RegisterAnnounceMailOnlyDefinitions registers workflow definitions involving announcing
281-
// onto h.
282-
//
283-
// This is superseded by RegisterReleaseWorkflows and will be removed
284-
// after some time, when we confirm there's no need for separate workflows.
285-
func RegisterAnnounceMailOnlyDefinitions(h *DefinitionHolder, tasks task.AnnounceMailTasks) {
286-
version := workflow.Parameter{
287-
Name: "Version",
288-
Doc: `Version is the Go version that has been released.
289-
290-
The version string must use the same format as Go tags.`,
291-
}
292-
security := workflow.Parameter{
293-
Name: "Security (optional)",
294-
ParameterType: workflow.SliceLong,
295-
Doc: `Security is a list of descriptions, one for each distinct security fix included in this release, in Markdown format.
296-
297-
The empty list means there are no security fixes included.
298-
299-
This field applies only to minor releases.
300-
301-
Past examples:
302-
• "encoding/pem: fix stack overflow in Decode
303-
304-
A large (more than 5 MB) PEM input can cause a stack overflow in Decode,
305-
leading the program to crash.
306-
307-
Thanks to Juho Nurminen of Mattermost who reported the error.
308-
309-
This is CVE-2022-24675 and Go issue https://go.dev/issue/51853."
310-
• "crypto/elliptic: tolerate all oversized scalars in generic P-256
311-
312-
A crafted scalar input longer than 32 bytes can cause P256().ScalarMult
313-
or P256().ScalarBaseMult to panic. Indirect uses through crypto/ecdsa and
314-
crypto/tls are unaffected. amd64, arm64, ppc64le, and s390x are unaffected.
315-
316-
This was discovered thanks to a Project Wycheproof test vector.
317-
318-
This is CVE-2022-28327 and Go issue https://go.dev/issue/52075."`,
319-
Example: `encoding/pem: fix stack overflow in Decode
320-
321-
A large (more than 5 MB) PEM input can cause a stack overflow in Decode,
322-
leading the program to crash.
323-
324-
Thanks to Juho Nurminen of Mattermost who reported the error.
325-
326-
This is CVE-2022-24675 and Go issue https://go.dev/issue/51853.`,
327-
}
328-
names := workflow.Parameter{
329-
Name: "Names (optional)",
330-
ParameterType: workflow.SliceShort,
331-
Doc: `Names is an optional list of release coordinator names to include in the sign-off message.`,
332-
}
333-
334-
{
335-
minorVersion := version
336-
minorVersion.Example = "go1.18.2"
337-
secondaryVersion := workflow.Parameter{
338-
Name: "SecondaryVersion (optional)",
339-
Doc: `SecondaryVersion is an older Go version that was also released,
340-
or the empty string if only one minor release was made.`,
341-
Example: "go1.17.10",
342-
}
343-
344-
wd := workflow.New()
345-
sentMail := wd.Task("mail-announcement", func(ctx *workflow.TaskContext, v1, v2 string, sec, names []string) (task.SentMail, error) {
346-
return tasks.AnnounceMinorRelease(ctx, task.ReleaseAnnouncement{Version: v1, SecondaryVersion: v2, Security: sec, Names: names})
347-
}, wd.Parameter(minorVersion), wd.Parameter(secondaryVersion), wd.Parameter(security), wd.Parameter(names))
348-
wd.Output("AnnouncementURL", wd.Task("await-announcement", tasks.AwaitAnnounceMail, sentMail))
349-
h.RegisterDefinition("announce-minor", wd)
350-
}
351-
{
352-
betaVersion := version
353-
betaVersion.Example = "go1.19beta1"
354-
355-
wd := workflow.New()
356-
sentMail := wd.Task("mail-announcement", func(ctx *workflow.TaskContext, v string, names []string) (task.SentMail, error) {
357-
return tasks.AnnounceBetaRelease(ctx, task.ReleaseAnnouncement{Version: v, Names: names})
358-
}, wd.Parameter(betaVersion), wd.Parameter(names))
359-
wd.Output("AnnouncementURL", wd.Task("await-announcement", tasks.AwaitAnnounceMail, sentMail))
360-
h.RegisterDefinition("announce-beta", wd)
361-
}
362-
{
363-
rcVersion := version
364-
rcVersion.Example = "go1.19rc1"
365-
366-
wd := workflow.New()
367-
sentMail := wd.Task("mail-announcement", func(ctx *workflow.TaskContext, v string, names []string) (task.SentMail, error) {
368-
return tasks.AnnounceRCRelease(ctx, task.ReleaseAnnouncement{Version: v, Names: names})
369-
}, wd.Parameter(rcVersion), wd.Parameter(names))
370-
wd.Output("AnnouncementURL", wd.Task("await-announcement", tasks.AwaitAnnounceMail, sentMail))
371-
h.RegisterDefinition("announce-rc", wd)
372-
}
373-
{
374-
majorVersion := version
375-
majorVersion.Example = "go1.19"
376-
377-
wd := workflow.New()
378-
sentMail := wd.Task("mail-announcement", func(ctx *workflow.TaskContext, v string, names []string) (task.SentMail, error) {
379-
return tasks.AnnounceMajorRelease(ctx, task.ReleaseAnnouncement{Version: v, Names: names})
380-
}, wd.Parameter(majorVersion), wd.Parameter(names))
381-
wd.Output("AnnouncementURL", wd.Task("await-announcement", tasks.AwaitAnnounceMail, sentMail))
382-
h.RegisterDefinition("announce-major", wd)
383-
}
384-
}
385-
386-
// RegisterTweetOnlyDefinitions registers workflow definitions involving tweeting
387-
// onto h.
388-
//
389-
// This is superseded by RegisterReleaseWorkflows and will be removed
390-
// after some time, when we confirm there's no need for separate workflows.
391-
func RegisterTweetOnlyDefinitions(h *DefinitionHolder, tasks task.TweetTasks) {
392-
version := workflow.Parameter{
393-
Name: "Version",
394-
Doc: `Version is the Go version that has been released.
395-
396-
The version string must use the same format as Go tags.`,
397-
}
398-
security := workflow.Parameter{
399-
Name: "Security (optional)",
400-
Doc: `Security is an optional sentence describing security fixes included in this release.
401-
402-
The empty string means there are no security fixes to highlight.
403-
404-
Past examples:
405-
• "Includes a security fix for crypto/tls (CVE-2021-34558)."
406-
• "Includes a security fix for the Wasm port (CVE-2021-38297)."
407-
• "Includes security fixes for encoding/pem (CVE-2022-24675), crypto/elliptic (CVE-2022-28327), crypto/x509 (CVE-2022-27536)."`,
408-
}
409-
announcement := workflow.Parameter{
410-
Name: "Announcement",
411-
ParameterType: workflow.URL,
412-
Doc: `Announcement is the announcement URL.
413-
414-
It's applicable to all release types other than major
415-
(since major releases point to release notes instead).`,
416-
Example: "https://groups.google.com/g/golang-announce/c/wB1fph5RpsE/m/ZGwOsStwAwAJ",
417-
}
418-
419-
{
420-
minorVersion := version
421-
minorVersion.Example = "go1.18.2"
422-
secondaryVersion := workflow.Parameter{
423-
Name: "SecondaryVersion (optional)",
424-
Doc: `SecondaryVersion is an older Go version that was also released,
425-
or the empty string if only one minor release was made.`,
426-
Example: "go1.17.10",
427-
}
428-
429-
wd := workflow.New()
430-
wd.Output("TweetURL", wd.Task("tweet-minor", func(ctx *workflow.TaskContext, v1, v2, sec, ann string) (string, error) {
431-
return tasks.TweetMinorRelease(ctx, task.ReleaseTweet{Version: v1, SecondaryVersion: v2, Security: sec, Announcement: ann})
432-
}, wd.Parameter(minorVersion), wd.Parameter(secondaryVersion), wd.Parameter(security), wd.Parameter(announcement)))
433-
h.RegisterDefinition("tweet-minor", wd)
434-
}
435-
{
436-
betaVersion := version
437-
betaVersion.Example = "go1.19beta1"
438-
439-
wd := workflow.New()
440-
wd.Output("TweetURL", wd.Task("tweet-beta", func(ctx *workflow.TaskContext, v, sec, ann string) (string, error) {
441-
return tasks.TweetBetaRelease(ctx, task.ReleaseTweet{Version: v, Security: sec, Announcement: ann})
442-
}, wd.Parameter(betaVersion), wd.Parameter(security), wd.Parameter(announcement)))
443-
h.RegisterDefinition("tweet-beta", wd)
444-
}
445-
{
446-
rcVersion := version
447-
rcVersion.Example = "go1.19rc1"
448-
449-
wd := workflow.New()
450-
wd.Output("TweetURL", wd.Task("tweet-rc", func(ctx *workflow.TaskContext, v, sec, ann string) (string, error) {
451-
return tasks.TweetRCRelease(ctx, task.ReleaseTweet{Version: v, Security: sec, Announcement: ann})
452-
}, wd.Parameter(rcVersion), wd.Parameter(security), wd.Parameter(announcement)))
453-
h.RegisterDefinition("tweet-rc", wd)
454-
}
455-
{
456-
majorVersion := version
457-
majorVersion.Example = "go1.19"
458-
459-
wd := workflow.New()
460-
wd.Output("TweetURL", wd.Task("tweet-major", func(ctx *workflow.TaskContext, v, sec string) (string, error) {
461-
return tasks.TweetMajorRelease(ctx, task.ReleaseTweet{Version: v, Security: sec})
462-
}, wd.Parameter(majorVersion), wd.Parameter(security)))
463-
h.RegisterDefinition("tweet-major", wd)
464-
}
465-
}
466-
467280
// newEchoWorkflow returns a runnable workflow.Definition for
468281
// development.
469282
func newEchoWorkflow() *workflow.Definition {
@@ -536,11 +349,32 @@ func ApproveActionDep(p *pgxpool.Pool) func(*workflow.TaskContext) error {
536349
}
537350
}
538351

539-
// TODO(go.dev/issue/53537): Flip to true.
540-
const mergeCommTasksIntoReleaseWorkflows = false
541-
542352
// RegisterReleaseWorkflows registers workflows for issuing Go releases.
543353
func RegisterReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *BuildReleaseTasks, milestone *task.MilestoneTasks, version *task.VersionTasks, comm task.CommunicationTasks) error {
354+
// Register prod release workflows both with, and without comm tasks at the end.
355+
// TODO(go.dev/issue/53537): Simplify after more experience.
356+
if err := registerProdReleaseWorkflows(ctx, h, build, milestone, version, comm, true, ""); err != nil {
357+
return err
358+
}
359+
if err := registerProdReleaseWorkflows(ctx, h, build, milestone, version, comm, false, "[without comms] "); err != nil {
360+
return err
361+
}
362+
363+
// Register dry-run release workflows.
364+
currentMajor, err := version.GetCurrentMajor(ctx)
365+
if err != nil {
366+
return err
367+
}
368+
wd := workflow.New()
369+
if err := addBuildAndTestOnlyWorkflow(wd, version, build, currentMajor+1, task.KindBeta); err != nil {
370+
return err
371+
}
372+
h.RegisterDefinition(fmt.Sprintf("dry-run (test and build only): Go 1.%d next beta", currentMajor+1), wd)
373+
374+
return nil
375+
}
376+
377+
func registerProdReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *BuildReleaseTasks, milestone *task.MilestoneTasks, version *task.VersionTasks, comm task.CommunicationTasks, mergeCommTasks bool, definitionPrefix string) error {
544378
currentMajor, err := version.GetCurrentMajor(ctx)
545379
if err != nil {
546380
return err
@@ -560,7 +394,7 @@ func RegisterReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *B
560394
wd := workflow.New()
561395

562396
var securitySummary, securityFixes, names workflow.Value
563-
if mergeCommTasksIntoReleaseWorkflows {
397+
if mergeCommTasks {
564398
if r.kind == task.KindCurrentMinor || r.kind == task.KindPrevMinor {
565399
securitySummary = wd.Parameter(securitySummaryParameter)
566400
securityFixes = wd.Parameter(securityFixesParameter)
@@ -573,24 +407,18 @@ func RegisterReleaseWorkflows(ctx context.Context, h *DefinitionHolder, build *B
573407
return err
574408
}
575409

576-
if mergeCommTasksIntoReleaseWorkflows {
410+
if mergeCommTasks {
577411
addCommTasksForSingleRelease(wd, build, comm, r.kind, versionPublished, securitySummary, securityFixes, names)
578412
}
579413

580-
h.RegisterDefinition(fmt.Sprintf("Go 1.%d %s", r.major, r.suffix), wd)
414+
h.RegisterDefinition(definitionPrefix+fmt.Sprintf("Go 1.%d %s", r.major, r.suffix), wd)
581415
}
582416

583-
wd, err := createMinorReleaseWorkflow(build, milestone, version, comm, currentMajor-1, currentMajor)
417+
wd, err := createMinorReleaseWorkflow(build, milestone, version, comm, mergeCommTasks, currentMajor-1, currentMajor)
584418
if err != nil {
585419
return err
586420
}
587-
h.RegisterDefinition(fmt.Sprintf("Minor releases for Go 1.%d and 1.%d", currentMajor-1, currentMajor), wd)
588-
589-
wd = workflow.New()
590-
if err := addBuildAndTestOnlyWorkflow(wd, version, build, currentMajor+1, task.KindBeta); err != nil {
591-
return err
592-
}
593-
h.RegisterDefinition(fmt.Sprintf("dry-run (test and build only): Go 1.%d next beta", currentMajor+1), wd)
421+
h.RegisterDefinition(definitionPrefix+fmt.Sprintf("Minor releases for Go 1.%d and 1.%d", currentMajor-1, currentMajor), wd)
594422

595423
return nil
596424
}
@@ -611,11 +439,11 @@ func addBuildAndTestOnlyWorkflow(wd *workflow.Definition, version *task.VersionT
611439
return nil
612440
}
613441

614-
func createMinorReleaseWorkflow(build *BuildReleaseTasks, milestone *task.MilestoneTasks, version *task.VersionTasks, comm task.CommunicationTasks, prevMajor, currentMajor int) (*workflow.Definition, error) {
442+
func createMinorReleaseWorkflow(build *BuildReleaseTasks, milestone *task.MilestoneTasks, version *task.VersionTasks, comm task.CommunicationTasks, mergeCommTasks bool, prevMajor, currentMajor int) (*workflow.Definition, error) {
615443
wd := workflow.New()
616444

617445
var securitySummary, securityFixes, names workflow.Value
618-
if mergeCommTasksIntoReleaseWorkflows {
446+
if mergeCommTasks {
619447
securitySummary = wd.Parameter(securitySummaryParameter)
620448
securityFixes = wd.Parameter(securityFixesParameter)
621449
names = wd.Parameter(releaseCoordinatorNames)
@@ -630,7 +458,7 @@ func createMinorReleaseWorkflow(build *BuildReleaseTasks, milestone *task.Milest
630458
return nil, err
631459
}
632460

633-
if mergeCommTasksIntoReleaseWorkflows {
461+
if mergeCommTasks {
634462
addCommTasksForDoubleMinorRelease(wd, build, comm, v1Published, v2Published, securitySummary, securityFixes, names)
635463
}
636464

0 commit comments

Comments
 (0)