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

Set the number of threads for release notes generation with a flag #13273

Merged
merged 2 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,5 @@ generate_ci_workflows:
generate-flag-testdata:
./tools/generate_flag_testdata.sh

release-notes:
go run ./go/tools/release-notes --from "$(FROM)" --to "$(TO)" --version "$(VERSION)" --summary "$(SUMMARY)"

install_kubectl_kind:
GuptaManan100 marked this conversation as resolved.
Show resolved Hide resolved
./tools/get_kubectl_kind.sh
8 changes: 6 additions & 2 deletions doc/internal/ReleaseInstructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,16 @@ We need to verify that _arewefastyet_ has finished the benchmark too.
2. Run the following command to generate the release notes:
1. Release Candidate:
```shell
make VERSION="v15.0.0-rc1" FROM="v14.0.3" TO="HEAD" SUMMARY="./changelog/15.0/15.0.0/summary.md" release-notes
go run ./go/tools/release-notes --from "v14.0.3" --to "HEAD" --version "v15.0.0-rc1" --summary "./changelog/15.0/15.0.0/summary.md" [--threads=[0-9.]]
```
2. General Availability:
```shell
make VERSION="v15.0.0-rc1" FROM="v14.0.3" TO="HEAD" SUMMARY="./changelog/15.0/15.0.0/summary.md" release-notes
go run ./go/tools/release-notes --from "v14.0.3" --to "HEAD" --version "v15.0.0" --summary "./changelog/15.0/15.0.0/summary.md" [--threads=[0-9.]]
```
> Important note: The release note generation fetches a lot of data from the GitHub API. You might reach the API request limit.
In which case you should use the `--threads=` flag and set an integer value lower than 10 (the default).
This command will generate the release notes by looking at all the commits between the tag `v14.0.3` and the reference `HEAD`.
It will also use the file located in `./changelog/15.0/15.0.0/summary.md` to prefix the release notes with a text that the maintainers wrote before the release.
Please verify the generated release notes to make sure it is well-formatted and all the bookmarks are generated properly.
Expand Down
5 changes: 4 additions & 1 deletion go/tools/release-notes/release_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type (

var (
releaseNotesPath = `changelog/`
numberOfThreads = 10
)

const (
Expand Down Expand Up @@ -134,7 +135,6 @@ The entire changelog for this release can be found [here]({{ .PathToChangeLogFil

prefixType = "Type: "
prefixComponent = "Component: "
numberOfThreads = 10
lengthOfSingleSHA = 40
)

Expand Down Expand Up @@ -499,8 +499,11 @@ func main() {
pflag.StringVarP(&to, "to", "t", to, "to sha/tag/branch")
pflag.StringVarP(&versionName, "version", "v", "", "name of the version (has to be the following format: v11.0.0)")
pflag.StringVarP(&summaryFile, "summary", "s", "", "readme file on which there is a summary of the release")
pflag.IntVar(&numberOfThreads, "threads", numberOfThreads, "Define the number of threads used to fetch data from GitHub's API. Lower this number if you hit request limit errors.")
pflag.Parse()

log.Println(numberOfThreads)
os.Exit(1)
// The -version flag must be of a valid format.
rx := regexp.MustCompile(`v([0-9]+)\.([0-9]+)\.([0-9]+)`)
// There should be 4 sub-matches, input: "v14.0.0", output: ["v14.0.0", "14", "0", "0"].
Expand Down