diff --git a/cmd/schedule-builder/cmd/markdown.go b/cmd/schedule-builder/cmd/markdown.go index ba7520022ef..4de410d5861 100644 --- a/cmd/schedule-builder/cmd/markdown.go +++ b/cmd/schedule-builder/cmd/markdown.go @@ -36,8 +36,11 @@ func parseSchedule(patchSchedule PatchSchedule) string { output = append(output, "### Timeline\n") for _, releaseSchedule := range patchSchedule.Schedules { output = append(output, fmt.Sprintf("### %s\n", releaseSchedule.Release), - fmt.Sprintf("Next patch release is **%s**\n", releaseSchedule.Next), - fmt.Sprintf("End of Life for **%s** is **%s**\n", releaseSchedule.Release, releaseSchedule.EndOfLifeDate)) + fmt.Sprintf("Next patch release is **%s**\n", releaseSchedule.Next.Release), + fmt.Sprintf("**%s** enters maintenance mode on **%s** and End of Life is on **%s**.\n", + releaseSchedule.Release, releaseSchedule.MaintenanceModeStartDate, releaseSchedule.EndOfLifeDate, + ), + ) tableString := &strings.Builder{} table := tablewriter.NewWriter(tableString) @@ -45,8 +48,8 @@ func parseSchedule(patchSchedule PatchSchedule) string { table.SetHeader([]string{"Patch Release", "Cherry Pick Deadline", "Target Date", "Note"}) // Check if the next patch release is in the Previous Patch list, if yes dont read in the output - if !patchReleaseInPreviousList(releaseSchedule.Next, releaseSchedule.PreviousPatches) { - table.Append([]string{strings.TrimSpace(releaseSchedule.Next), strings.TrimSpace(releaseSchedule.CherryPickDeadline), strings.TrimSpace(releaseSchedule.TargetDate), ""}) + if !patchReleaseInPreviousList(releaseSchedule.Next.Release, releaseSchedule.PreviousPatches) { + table.Append([]string{strings.TrimSpace(releaseSchedule.Next.Release), strings.TrimSpace(releaseSchedule.Next.CherryPickDeadline), strings.TrimSpace(releaseSchedule.Next.TargetDate), ""}) } for _, previous := range releaseSchedule.PreviousPatches { @@ -113,7 +116,7 @@ func parseReleaseSchedule(releaseSchedule ReleaseSchedule) string { return scheduleOut } -func patchReleaseInPreviousList(a string, previousPatches []PreviousPatches) bool { +func patchReleaseInPreviousList(a string, previousPatches []PatchRelease) bool { for _, b := range previousPatches { if b.Release == a { return true diff --git a/cmd/schedule-builder/cmd/markdown_test.go b/cmd/schedule-builder/cmd/markdown_test.go index 4f84c910786..ade1910383f 100644 --- a/cmd/schedule-builder/cmd/markdown_test.go +++ b/cmd/schedule-builder/cmd/markdown_test.go @@ -29,7 +29,7 @@ const expectedPatchSchedule = `### Timeline Next patch release is **X.Y.ZZZ** -End of Life for **X.Y** is **NOW** +**X.Y** enters maintenance mode on **THEN** and End of Life is on **NOW**. | PATCH RELEASE | CHERRY PICK DEADLINE | TARGET DATE | NOTE | |---------------|----------------------|-------------|------| @@ -131,12 +131,15 @@ func TestParseSchedule(t *testing.T) { schedule: PatchSchedule{ Schedules: []Schedule{ { - Release: "X.Y", - Next: "X.Y.ZZZ", - CherryPickDeadline: "2020-06-12", - TargetDate: "2020-06-17", - EndOfLifeDate: "NOW", - PreviousPatches: []PreviousPatches{ + Release: "X.Y", + Next: &PatchRelease{ + Release: "X.Y.ZZZ", + CherryPickDeadline: "2020-06-12", + TargetDate: "2020-06-17", + }, + EndOfLifeDate: "NOW", + MaintenanceModeStartDate: "THEN", + PreviousPatches: []PatchRelease{ { Release: "X.Y.XXX", CherryPickDeadline: "2020-05-15", @@ -158,12 +161,15 @@ func TestParseSchedule(t *testing.T) { schedule: PatchSchedule{ Schedules: []Schedule{ { - Release: "X.Y", - Next: "X.Y.ZZZ", - CherryPickDeadline: "2020-06-12", - TargetDate: "2020-06-17", - EndOfLifeDate: "NOW", - PreviousPatches: []PreviousPatches{ + Release: "X.Y", + Next: &PatchRelease{ + Release: "X.Y.ZZZ", + CherryPickDeadline: "2020-06-12", + TargetDate: "2020-06-17", + }, + EndOfLifeDate: "NOW", + MaintenanceModeStartDate: "THEN", + PreviousPatches: []PatchRelease{ { Release: "X.Y.ZZZ", CherryPickDeadline: "2020-06-12", diff --git a/cmd/schedule-builder/cmd/model.go b/cmd/schedule-builder/cmd/model.go index 2b8b7106db1..c8b991870d6 100644 --- a/cmd/schedule-builder/cmd/model.go +++ b/cmd/schedule-builder/cmd/model.go @@ -21,8 +21,8 @@ type PatchSchedule struct { Schedules []Schedule `yaml:"schedules"` } -// PreviousPatches struct to define the old patch schedules -type PreviousPatches struct { +// PatchRelease struct to define the patch schedules +type PatchRelease struct { Release string `yaml:"release"` CherryPickDeadline string `yaml:"cherryPickDeadline"` TargetDate string `yaml:"targetDate"` @@ -31,12 +31,12 @@ type PreviousPatches struct { // Schedule struct to define the release schedule for a specific version type Schedule struct { - Release string `yaml:"release"` - Next string `yaml:"next"` - CherryPickDeadline string `yaml:"cherryPickDeadline"` - TargetDate string `yaml:"targetDate"` - EndOfLifeDate string `yaml:"endOfLifeDate"` - PreviousPatches []PreviousPatches `yaml:"previousPatches"` + Release string `yaml:"release"` + ReleaseDate string `yaml:"releaseDate"` + Next *PatchRelease `yaml:"next"` + EndOfLifeDate string `yaml:"endOfLifeDate"` + MaintenanceModeStartDate string `yaml:"maintenanceModeStartDate"` + PreviousPatches []PatchRelease `yaml:"previousPatches"` } type ReleaseSchedule struct { diff --git a/cmd/schedule-builder/cmd/root.go b/cmd/schedule-builder/cmd/root.go index deb0bf48b8c..d23e6a8f178 100644 --- a/cmd/schedule-builder/cmd/root.go +++ b/cmd/schedule-builder/cmd/root.go @@ -58,7 +58,6 @@ const ( var requiredFlags = []string{ configPathFlag, - typeFlag, } // Execute adds all child commands to the root command and sets flags appropriately. diff --git a/cmd/schedule-builder/cmd/root_test.go b/cmd/schedule-builder/cmd/root_test.go index d95a78bf219..50c4defcc21 100644 --- a/cmd/schedule-builder/cmd/root_test.go +++ b/cmd/schedule-builder/cmd/root_test.go @@ -35,7 +35,7 @@ const expectedPatchOut = `### Timeline Next patch release is **1.18.4** -End of Life for **1.18** is **TBD** +**1.18** enters maintenance mode on **TBD** and End of Life is on **TBD**. | PATCH RELEASE | CHERRY PICK DEADLINE | TARGET DATE | NOTE | |---------------|----------------------|-------------|------| @@ -47,7 +47,7 @@ End of Life for **1.18** is **TBD** Next patch release is **1.17.7** -End of Life for **1.17** is **TBD** +**1.17** enters maintenance mode on **TBD** and End of Life is on **TBD**. | PATCH RELEASE | CHERRY PICK DEADLINE | TARGET DATE | NOTE | |---------------|----------------------|-------------|------| @@ -58,7 +58,7 @@ End of Life for **1.17** is **TBD** Next patch release is **1.16.11** -End of Life for **1.16** is **TBD** +**1.16** enters maintenance mode on **TBD** and End of Life is on **TBD**. | PATCH RELEASE | CHERRY PICK DEADLINE | TARGET DATE | NOTE | |---------------|----------------------|-------------|------| diff --git a/cmd/schedule-builder/cmd/testdata/schedule.yaml b/cmd/schedule-builder/cmd/testdata/schedule.yaml index fed2e835956..d106679a662 100644 --- a/cmd/schedule-builder/cmd/testdata/schedule.yaml +++ b/cmd/schedule-builder/cmd/testdata/schedule.yaml @@ -1,9 +1,11 @@ schedules: - release: 1.18 - next: 1.18.4 - cherryPickDeadline: 2020-06-12 - targetDate: 2020-06-17 + next: + release: 1.18.4 + cherryPickDeadline: 2020-06-12 + targetDate: 2020-06-17 endOfLifeDate: TBD + maintenanceModeStartDate: TBD previousPatches: - release: 1.18.3 cherryPickDeadline: 2020-05-15 @@ -12,19 +14,23 @@ schedules: cherryPickDeadline: 2020-04-13 targetDate: 2020-04-16 - release: 1.17 - next: 1.17.7 - cherryPickDeadline: 2020-06-12 - targetDate: 2020-06-17 + next: + release: 1.17.7 + cherryPickDeadline: 2020-06-12 + targetDate: 2020-06-17 endOfLifeDate: TBD + maintenanceModeStartDate: TBD previousPatches: - release: 1.17.6 cherryPickDeadline: 2020-05-15 targetDate: 2020-05-20 - release: 1.16 - next: 1.16.11 - cherryPickDeadline: 2020-06-12 - targetDate: 2020-06-17 + next: + release: 1.16.11 + cherryPickDeadline: 2020-06-12 + targetDate: 2020-06-17 endOfLifeDate: TBD + maintenanceModeStartDate: TBD previousPatches: - release: 1.16.10 cherryPickDeadline: 2020-05-15