Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schedule-builder: Add markdown help #3583

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/schedule-builder/cmd/markdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ func processFile(fileName string, vars interface{}) string {
const (
refDate = "2006-01-02"
refDateMonthly = "January 2006"
markdownHelp = `# Use "schedule-builder" to maintain this file:
# https://github.com/kubernetes/release/tree/master/cmd/schedule-builder
# For example by running:
# schedule-builder -uc data/releases/schedule.yaml -e data/releases/eol.yaml
---
`
)

func updatePatchSchedule(refTime time.Time, schedule PatchSchedule, eolBranches EolBranches, filePath, eolFilePath string) error {
Expand Down Expand Up @@ -311,6 +317,7 @@ func updatePatchSchedule(refTime time.Time, schedule PatchSchedule, eolBranches
if err != nil {
return fmt.Errorf("marshal schedule YAML: %w", err)
}
yamlBytes = append([]byte(markdownHelp), yamlBytes...)

//nolint:gocritic,gosec
if err := os.WriteFile(filePath, yamlBytes, 0o644); err != nil {
Expand All @@ -324,6 +331,7 @@ func updatePatchSchedule(refTime time.Time, schedule PatchSchedule, eolBranches
if err != nil {
return fmt.Errorf("marshal end of life YAML: %w", err)
}
yamlBytes = append([]byte(markdownHelp), yamlBytes...)

//nolint:gocritic,gosec
if err := os.WriteFile(eolFilePath, yamlBytes, 0o644); err != nil {
Expand Down