Skip to content

Commit

Permalink
Merge pull request #8788 from danudey/dfox_validate_release_notes_v3.27
Browse files Browse the repository at this point in the history
Add 'release notes exist' validation to release process [cp #8786][v3.27]
  • Loading branch information
caseydavenport committed Jun 12, 2024
2 parents 367b376 + 8a066fd commit 13bd2a8
Showing 1 changed file with 24 additions and 0 deletions.
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

0 comments on commit 13bd2a8

Please sign in to comment.