Skip to content

Commit e2a6737

Browse files
authored
Fix release note generation script (#2056)
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 ```
1 parent 1b14e8c commit e2a6737

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

scripts/create_release_tag.sh

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,34 +140,51 @@ function generate_changelog {
140140

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

143+
# PR title line will be suffixed with (#<PR number>)
144+
prTitle=$(echo $log | head -n1)
145+
if [[ $prTitle =~ \(\#([0-9]+)\) ]]; then
146+
prNum=${BASH_REMATCH[1]}
147+
fi
148+
143149
# Get the type of change (cleanup|bug|feature).
144150
typeRe='Type of change: /kind ([A-Za-z]+)'
145151
if [[ $log =~ $typeRe ]]; then
146152
changeType=${BASH_REMATCH[1]}
147153
fi
148154

149155
# Get release notes.
150-
notesRe="\`\`\`release-note\s*(.*)\`\`\`"
151-
if [[ $log =~ $notesRe ]]; then
152-
releaseNote=${BASH_REMATCH[1]}
153-
fi
156+
releaseNote=$(echo "$log" | awk '
157+
BEGIN { output = ""; capturing = 0 }
158+
/Changelog Message:/ { capturing = 1 }
159+
/---------/ { capturing = 0 }
160+
/Signed-off-by/ { capturing = 0 }
161+
capturing {
162+
print $0
163+
}
164+
' | sed 's/Changelog Message: //')
154165

155166
declare -a cleanup_changelog
156167
declare -a bug_changelog
157168
declare -a feature_changelog
158169

159170
if [[ -n $releaseNote ]]; then
171+
fullReleaseNote="(#$prNum) $releaseNote"
160172
case $changeType in
161173
"cleanup")
162-
cleanup_changelog+=("$releaseNote")
174+
cleanup_changelog+=("$fullReleaseNote")
163175
;;
164176
"bug")
165-
bug_changelog+=("$releaseNote")
177+
bug_changelog+=("$fullReleaseNote")
178+
;;
179+
"bugfix")
180+
bug_changelog+=("$fullReleaseNote")
166181
;;
167182
"feature")
168-
feature_changelog+=("$releaseNote")
183+
feature_changelog+=("$fullReleaseNote")
169184
;;
170185
*)
186+
# If the type change is wrong, fail so that invalid entries can be fixed
187+
exit 1
171188
;;
172189
esac
173190
fi
@@ -248,6 +265,7 @@ if [ "$RELEASE" != "true" ]; then
248265
new_version_str=$(update_pre "$new_version_str" "$commit_count" "$sanitized_branch")
249266
fi
250267

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

253271
new_tag="release/$ARTIFACT_TYPE/v"$new_version_str

0 commit comments

Comments
 (0)