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

Add 'release notes exist' validation to release process [cp #8786][v3.27] #8788

Open
wants to merge 1 commit into
base: release-v3.27
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions hack/release/pkg/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ func (r *ReleaseBuilder) BuildRelease() error {
return err
}

err = r.assertReleaseNotesPresent(ver)
if err != nil {
return err
}

// Assert that manifests are using the correct version.
err = r.assertManifestVersions(ver)
if err != nil {
Expand Down Expand Up @@ -590,6 +595,25 @@ func (r *ReleaseBuilder) publishContainerImages(ver string) error {
return nil
}

func (r *ReleaseBuilder) assertReleaseNotesPresent(ver string) error {
// Validate that the release notes for this version are present,
// fail if not.

releaseNotesPath := fmt.Sprintf("release-notes/%s-release-notes.md", ver)
releaseNotesStat, err := os.Stat(releaseNotesPath)

// If we got an error, handle that?
if err != nil {
return fmt.Errorf("release notes file is invalid: %s", err.Error())
}
if releaseNotesStat.Size() == 0 {
return fmt.Errorf("release notes file is invalid: file is 0 bytes")
} else if releaseNotesStat.IsDir() {
return fmt.Errorf("release notes file is invalid: %s is a directory", releaseNotesPath)
}
return nil
}

func (r *ReleaseBuilder) assertManifestVersions(ver string) error {
// Go through a subset of yaml files in manifests/ and extract the images
// that they use. Verify that the images are using the given version.
Expand Down