diff --git a/cmd/patch-release-notify/cmd/root.go b/cmd/patch-release-notify/cmd/root.go index 071c0bcf2d88..2d1ccf9dbae1 100644 --- a/cmd/patch-release-notify/cmd/root.go +++ b/cmd/patch-release-notify/cmd/root.go @@ -19,6 +19,7 @@ package cmd import ( "bytes" "embed" + "errors" "fmt" "html/template" "io" @@ -29,7 +30,6 @@ import ( "strings" "time" - "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -159,18 +159,18 @@ func initLogging(*cobra.Command, []string) error { func run(opts *options) error { if err := opts.SetAndValidate(); err != nil { - return errors.Wrap(err, "validating schedule-path options") + return fmt.Errorf("validating schedule-path options: %w", err) } if opts.sendgridAPIKey == "" { - return errors.Errorf( + return fmt.Errorf( "$%s is not set", sendgridAPIKeyEnvKey, ) } data, err := loadFileOrURL(opts.schedulePath) if err != nil { - return errors.Wrap(err, "failed to read the file") + return fmt.Errorf("failed to read the file: %w", err) } patchSchedule := &model.PatchSchedule{} @@ -178,7 +178,7 @@ func run(opts *options) error { logrus.Info("Parsing the schedule...") if err := yaml.UnmarshalStrict(data, &patchSchedule); err != nil { - return errors.Wrap(err, "failed to decode the file") + return fmt.Errorf("failed to decode the file: %w", err) } output := &Template{} @@ -188,7 +188,7 @@ func run(opts *options) error { for _, patch := range patchSchedule.Schedules { t, err := time.Parse(layout, patch.CherryPickDeadline) if err != nil { - return errors.Wrap(err, "parsing schedule time") + return fmt.Errorf("parsing schedule time: %w", err) } currentTime := time.Now().UTC() @@ -205,13 +205,13 @@ func run(opts *options) error { tmpl, err := template.ParseFS(tpls, "templates/email.tmpl") if err != nil { - return errors.Wrap(err, "parsing template") + return fmt.Errorf("parsing template: %w", err) } var tmplBytes bytes.Buffer err = tmpl.Execute(&tmplBytes, output) if err != nil { - return errors.Wrap(err, "parsing values to the template") + return fmt.Errorf("parsing values to the template: %w", err) } if shouldSendEmail { @@ -225,12 +225,12 @@ func run(opts *options) error { if opts.name != "" && opts.email != "" { if err := m.SetSender(opts.name, opts.email); err != nil { - return errors.Wrap(err, "unable to set mail sender") + return fmt.Errorf("unable to set mail sender: %w", err) } } else { logrus.Info("Retrieving default sender from sendgrid API") if err := m.SetDefaultSender(); err != nil { - return errors.Wrap(err, "setting default sender") + return fmt.Errorf("setting default sender: %w", err) } } @@ -243,14 +243,14 @@ func run(opts *options) error { logrus.Infof("Using Google Groups as announcement target: %v", groups) if err := m.SetGoogleGroupRecipients(groups...); err != nil { - return errors.Wrap(err, "unable to set mail recipients") + return fmt.Errorf("unable to set mail recipients: %w", err) } logrus.Info("Sending mail") subject := "[Please Read] Patch Releases cherry-pick deadline" if err := m.Send(tmplBytes.String(), subject); err != nil { - return errors.Wrap(err, "unable to send mail") + return fmt.Errorf("unable to send mail: %w", err) } } else { logrus.Info("No email is needed to send") @@ -264,7 +264,7 @@ func (o *options) SetAndValidate() error { logrus.Info("Validating schedule-path options...") if o.schedulePath == "" { - return errors.Errorf("need to set the schedule-path") + return errors.New("need to set the schedule-path") } return nil diff --git a/cmd/patch-release-notify/cmd/templates/email.tmpl b/cmd/patch-release-notify/cmd/templates/email.tmpl index bce94b7e0173..6fbdd7704e91 100644 --- a/cmd/patch-release-notify/cmd/templates/email.tmpl +++ b/cmd/patch-release-notify/cmd/templates/email.tmpl @@ -1,34 +1,32 @@ -Hello Kubernetes Community! - + + + +

Hello Kubernetes Community!

{{range .Releases}} -The cherry-pick deadline for the {{ .Release }} branches is {{ .CherryPickDeadline }} EOD PT. +

The cherry-pick deadline for the {{ .Release }} branches is {{ .CherryPickDeadline }} EOD PT.

{{end}} - -Here are some quick links to search for cherry-pick PRs: - +

Here are some quick links to search for cherry-pick PRs:

{{range .Releases}} - - release-{{ .Release }}: https://github.com/kubernetes/kubernetes/pulls?q=is%3Apr+is%3Aopen+base%3Arelease-{{ .Release }}+label%3Ado-not-merge%2Fcherry-pick-not-approved +

- release-{{ .Release }}: https://github.com/kubernetes/kubernetes/pulls?q=is%3Apr+is%3Aopen+base%3Arelease-{{ .Release }}+label%3Ado-not-merge%2Fcherry-pick-not-approved

{{end}} - - -For PRs that you intend to land for the upcoming patch sets, please -ensure they have: -- a release note in the PR description -- /sig -- /kind -- /priority -- /lgtm -- /approve -- passing tests - -Details on the cherry-pick process can be found here: -https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md - -We keep general info and up-to-date timelines for patch releases here: -https://kubernetes.io/releases/patch-releases/#upcoming-monthly-releases - -If you have any questions for the Release Managers, please feel free to -reach out to us at #release-management (Kubernetes Slack) or release-managers@kubernetes.io - -We wish everyone a happy and safe week! -SIG-Release Team +
+

For PRs that you intend to land for the upcoming patch sets, please +ensure they have:

+

- a release note in the PR description

+

- /sig

+

- /kind

+

- /priority

+

- /lgtm

+

- /approve

+

- passing tests

+
+

Details on the cherry-pick process can be found here:

+

https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md

+

We keep general info and up-to-date timelines for patch releases here:

+

https://kubernetes.io/releases/patch-releases/#upcoming-monthly-releases

+

If you have any questions for the Release Managers, please feel free to +reach out to us at #release-management (Kubernetes Slack) or release-managers@kubernetes.io


+

We wish everyone a happy and safe week!

+

SIG-Release Team

+ +