Skip to content

Commit

Permalink
Set the number of threads for release notes generation with a flag (v…
Browse files Browse the repository at this point in the history
…itessio#13273)

* Set the number of threads for release notes generation by a flag

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

* Add the flag to the release instructions and remove the make commande for release notes

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>

---------

Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
  • Loading branch information
frouioui committed Jun 13, 2023
1 parent 60baf51 commit 1deb144
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ vtadmin_authz_testgen:
generate_ci_workflows:
cd test && go run ci_workflow_gen.go && cd ..

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

install_kubectl_kind:
./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 @@ -256,12 +256,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

0 comments on commit 1deb144

Please sign in to comment.