Skip to content

Commit

Permalink
Fix release note generation script (#2056)
Browse files Browse the repository at this point in the history
Summary: Fix release note generation script

Our releases have blank release notes. This makes it difficult for end
users to understand what has changed between releases. This PR updates
the existing script that was built to auto generate changelog notes.

Relevant Issues: N/A

Type of change: /kind bug

Test Plan: Ran the script for each artifact type and verified the output
was expected
- [x] cli release notes are expected
```
$ ./scripts/create_release_tag.sh cli -n
$ git tag -l --format='%(contents)' release/cli/v0.9.0-pre-ddelnano-fix-release-note-generation.4
### New Features
- (#2048) Enhanced the `px` cli to detect OpenShift clusters
and prompt to install the appropriate SecurityContextConstraints before
proceeding with a deploy
```
- [x] vizier release notes are expected
```
# Needed to modify prev_tag in script since v0.14.13 to main's HEAD doesn't have vizier changelog messages
$ ./scripts/create_release_tag.sh vizier -n
$ git tag -l --format='%(contents)' release/vizier/v0.15.0-pre-main.4
### Bug Fixes
- (#2047) Ensures that the `--stirling_bpf_loop_limit` and
`--stirling_bpf_chunk_limit` values are respected if explicitly provided
on the command line. For 5.1 and later kernels, cli provided values
would have been ignored

```
- [x] cloud release notes are generated correctly
```
$ ./scripts/create_release_tag.sh cloud -n
Generating changelog from release/cloud/v0.1.8..release/cloud/v0.2.0-pre-ddelnano-fix-release-note-generation.1

$ git tag -l --format='%(contents)' release/cloud/v0.2.0-pre-ddelnano-fix-release-note-generation.1
### New Features
- (#2043) Add support for rendering differential flamegraphs in
the `StackTraceFlameGraph` display spec
### Bug Fixes
- (#2041) Upgraded bcc and libbpf to support kernels 6.10 and
later
```
  • Loading branch information
ddelnano authored Dec 16, 2024
1 parent 1b14e8c commit e2a6737
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions scripts/create_release_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,34 +140,51 @@ function generate_changelog {

log=$(git log --format=%B -n 1 "$commit")

# PR title line will be suffixed with (#<PR number>)
prTitle=$(echo $log | head -n1)
if [[ $prTitle =~ \(\#([0-9]+)\) ]]; then
prNum=${BASH_REMATCH[1]}
fi

# Get the type of change (cleanup|bug|feature).
typeRe='Type of change: /kind ([A-Za-z]+)'
if [[ $log =~ $typeRe ]]; then
changeType=${BASH_REMATCH[1]}
fi

# Get release notes.
notesRe="\`\`\`release-note\s*(.*)\`\`\`"
if [[ $log =~ $notesRe ]]; then
releaseNote=${BASH_REMATCH[1]}
fi
releaseNote=$(echo "$log" | awk '
BEGIN { output = ""; capturing = 0 }
/Changelog Message:/ { capturing = 1 }
/---------/ { capturing = 0 }
/Signed-off-by/ { capturing = 0 }
capturing {
print $0
}
' | sed 's/Changelog Message: //')

declare -a cleanup_changelog
declare -a bug_changelog
declare -a feature_changelog

if [[ -n $releaseNote ]]; then
fullReleaseNote="(#$prNum) $releaseNote"
case $changeType in
"cleanup")
cleanup_changelog+=("$releaseNote")
cleanup_changelog+=("$fullReleaseNote")
;;
"bug")
bug_changelog+=("$releaseNote")
bug_changelog+=("$fullReleaseNote")
;;
"bugfix")
bug_changelog+=("$fullReleaseNote")
;;
"feature")
feature_changelog+=("$releaseNote")
feature_changelog+=("$fullReleaseNote")
;;
*)
# If the type change is wrong, fail so that invalid entries can be fixed
exit 1
;;
esac
fi
Expand Down Expand Up @@ -248,6 +265,7 @@ if [ "$RELEASE" != "true" ]; then
new_version_str=$(update_pre "$new_version_str" "$commit_count" "$sanitized_branch")
fi

echo "Generating changelog from ${prev_tag}..release/${ARTIFACT_TYPE}/v${new_version_str}"
changelog=$(generate_changelog "$prev_tag" "$BAZEL_TARGET")

new_tag="release/$ARTIFACT_TYPE/v"$new_version_str
Expand Down

0 comments on commit e2a6737

Please sign in to comment.