1
1
#! /bin/bash
2
2
3
3
# Script to generate release notes for InfluxDB v3.x releases
4
- # Usage: ./generate-release-notes.sh <from_version> <to_version> <repo_path>
4
+ # Usage: ./generate-release-notes.sh [--no-fetch] [--pull] <from_version> <to_version> <primary_repo_path> [additional_repo_paths...]
5
+ #
6
+ # Options:
7
+ # --no-fetch Skip fetching latest commits from remote
8
+ # --pull Pull latest changes (implies fetch) - use with caution as it may change your working directory
9
+ #
10
+ # Example: ./generate-release-notes.sh v3.1.0 v3.2.0 /path/to/influxdb /path/to/influxdb_pro /path/to/influxdb_iox
11
+ # Example: ./generate-release-notes.sh --no-fetch v3.1.0 v3.2.0 /path/to/influxdb
12
+ # Example: ./generate-release-notes.sh --pull v3.1.0 v3.2.0 /path/to/influxdb /path/to/influxdb_pro
5
13
6
14
set -e
7
15
8
- # Default values
9
- REPO_PATH=" ${3:-/ Users/ ja/ Documents/ github/ influxdb} "
16
+ # Parse command line options
17
+ FETCH_COMMITS=true
18
+ PULL_COMMITS=false
19
+
20
+ while [[ $# -gt 0 ]]; do
21
+ case $1 in
22
+ --no-fetch)
23
+ FETCH_COMMITS=false
24
+ shift
25
+ ;;
26
+ --pull)
27
+ PULL_COMMITS=true
28
+ FETCH_COMMITS=true
29
+ shift
30
+ ;;
31
+ -* )
32
+ echo " Unknown option $1 "
33
+ exit 1
34
+ ;;
35
+ * )
36
+ break
37
+ ;;
38
+ esac
39
+ done
40
+
41
+ # Parse remaining arguments
10
42
FROM_VERSION=" ${1:- v3.1.0} "
11
43
TO_VERSION=" ${2:- v3.2.0} "
44
+ PRIMARY_REPO=" ${3:-/ Users/ ja/ Documents/ github/ influxdb} "
45
+
46
+ # Collect additional repositories (all arguments after the third)
47
+ ADDITIONAL_REPOS=()
48
+ shift 3 2> /dev/null || true
49
+ while [ $# -gt 0 ]; do
50
+ ADDITIONAL_REPOS+=(" $1 " )
51
+ shift
52
+ done
12
53
13
54
# Colors for output
14
55
RED=' \033[0;31m'
@@ -18,36 +59,170 @@ BLUE='\033[0;34m'
18
59
NC=' \033[0m' # No Color
19
60
20
61
echo -e " ${BLUE} Generating release notes for ${TO_VERSION}${NC} "
21
- echo -e " Repository: ${REPO_PATH} "
62
+ echo -e " Primary Repository: ${PRIMARY_REPO} "
63
+ if [ ${# ADDITIONAL_REPOS[@]} -gt 0 ]; then
64
+ echo -e " Additional Repositories:"
65
+ for repo in " ${ADDITIONAL_REPOS[@]} " ; do
66
+ echo -e " - ${repo} "
67
+ done
68
+ fi
22
69
echo -e " From: ${FROM_VERSION} To: ${TO_VERSION} \n"
23
70
24
71
# Function to extract PR number from commit message
25
72
extract_pr_number () {
26
73
echo " $1 " | grep -oE ' #[0-9]+' | head -1 | sed ' s/#//'
27
74
}
28
75
76
+ # Function to get commits from a repository
77
+ get_commits_from_repo () {
78
+ local repo_path=" $1 "
79
+ local pattern=" $2 "
80
+ local format=" ${3:-% h % s} "
81
+
82
+ if [ -d " $repo_path " ]; then
83
+ git -C " $repo_path " log --format=" $format " " ${FROM_VERSION} ..${TO_VERSION} " 2> /dev/null | grep -E " $pattern " || true
84
+ fi
85
+ }
86
+
87
+ # Function to analyze API-related commits
88
+ analyze_api_changes () {
89
+ local repo_path=" $1 "
90
+ local repo_name=" $2 "
91
+
92
+ if [ ! -d " $repo_path " ]; then
93
+ return
94
+ fi
95
+
96
+ # Look for API-related file changes
97
+ local api_files=$( git -C " $repo_path " diff --name-only " ${FROM_VERSION} ..${TO_VERSION} " 2> /dev/null | grep -E " (api|handler|endpoint|route)" | head -10 || true)
98
+
99
+ # Look for specific API endpoint patterns in commit messages and diffs
100
+ local api_commits=$( git -C " $repo_path " log --format=" %h %s" " ${FROM_VERSION} ..${TO_VERSION} " 2> /dev/null | \
101
+ grep -iE " (api|endpoint|/write|/query|/ping|/health|/metrics|v1|v2|v3)" || true)
102
+
103
+ if [ -n " $api_files " ] || [ -n " $api_commits " ]; then
104
+ echo " Repository: $repo_name "
105
+ if [ -n " $api_files " ]; then
106
+ echo " Modified API files:"
107
+ echo " $api_files " | while read -r file; do
108
+ echo " - $file "
109
+ done
110
+ fi
111
+ if [ -n " $api_commits " ]; then
112
+ echo " API-related commits:"
113
+ echo " $api_commits " | while read -r commit; do
114
+ echo " - $commit "
115
+ done
116
+ fi
117
+ echo
118
+ fi
119
+ }
120
+
29
121
# Get the release date
30
- RELEASE_DATE=$( git -C " $REPO_PATH " log -1 --format=%ai " $TO_VERSION " | cut -d' ' -f1)
122
+ RELEASE_DATE=$( git -C " $PRIMARY_REPO " log -1 --format=%ai " $TO_VERSION " | cut -d' ' -f1)
31
123
echo -e " ${GREEN} Release Date: ${RELEASE_DATE}${NC} \n"
32
124
33
- # Collect commits by category
34
- echo -e " ${YELLOW} Analyzing commits...${NC} "
125
+ # Create array of all repositories
126
+ ALL_REPOS=(" $PRIMARY_REPO " )
127
+ for repo in " ${ADDITIONAL_REPOS[@]} " ; do
128
+ ALL_REPOS+=(" $repo " )
129
+ done
35
130
36
- # Features
37
- echo -e " \n${GREEN} Features:${NC} "
38
- FEATURES=$( git -C " $REPO_PATH " log --format=" %h %s" " ${FROM_VERSION} ..${TO_VERSION} " | grep -E " ^[a-f0-9]+ feat:" | sed ' s/^[a-f0-9]* feat: //' )
131
+ # Fetch latest commits from all repositories (if enabled)
132
+ if [ " $FETCH_COMMITS " = true ]; then
133
+ if [ " $PULL_COMMITS " = true ]; then
134
+ echo -e " ${YELLOW} Pulling latest changes from all repositories...${NC} "
135
+ echo -e " ${RED} Warning: This will modify your working directories!${NC} "
136
+ else
137
+ echo -e " ${YELLOW} Fetching latest commits from all repositories...${NC} "
138
+ fi
139
+
140
+ for repo in " ${ALL_REPOS[@]} " ; do
141
+ if [ -d " $repo " ]; then
142
+ repo_name=$( basename " $repo " )
143
+
144
+ if [ " $PULL_COMMITS " = true ]; then
145
+ echo -e " Pulling changes in $repo_name ..."
146
+ if git -C " $repo " pull origin 2> /dev/null; then
147
+ echo -e " ${GREEN} ✓${NC} Successfully pulled changes in $repo_name "
148
+ else
149
+ echo -e " ${RED} ✗${NC} Failed to pull changes in $repo_name (trying fetch only)"
150
+ if git -C " $repo " fetch origin 2> /dev/null; then
151
+ echo -e " ${GREEN} ✓${NC} Successfully fetched from $repo_name "
152
+ else
153
+ echo -e " ${RED} ✗${NC} Failed to fetch from $repo_name (continuing with local commits)"
154
+ fi
155
+ fi
156
+ else
157
+ echo -e " Fetching from $repo_name ..."
158
+ if git -C " $repo " fetch origin 2> /dev/null; then
159
+ echo -e " ${GREEN} ✓${NC} Successfully fetched from $repo_name "
160
+ else
161
+ echo -e " ${RED} ✗${NC} Failed to fetch from $repo_name (continuing with local commits)"
162
+ fi
163
+ fi
164
+ else
165
+ echo -e " ${RED} ✗${NC} Repository not found: $repo "
166
+ fi
167
+ done
168
+ else
169
+ echo -e " ${YELLOW} Skipping fetch (using local commits only)${NC} "
170
+ fi
171
+
172
+ # Collect commits by category from all repositories
173
+ echo -e " \n${YELLOW} Analyzing commits across all repositories...${NC} "
39
174
40
- # Fixes
41
- echo -e " \n${GREEN} Bug Fixes:${NC} "
42
- FIXES=$( git -C " $REPO_PATH " log --format=" %h %s" " ${FROM_VERSION} ..${TO_VERSION} " | grep -E " ^[a-f0-9]+ fix:" | sed ' s/^[a-f0-9]* fix: //' )
175
+ # Initialize variables
176
+ FEATURES=" "
177
+ FIXES=" "
178
+ BREAKING=" "
179
+ PERF=" "
180
+ API_CHANGES=" "
43
181
44
- # Breaking changes
45
- echo -e " \n${GREEN} Breaking Changes:${NC} "
46
- BREAKING=$( git -C " $REPO_PATH " log --format=" %h %s" " ${FROM_VERSION} ..${TO_VERSION} " | grep -iE " ^[a-f0-9]+ .*(BREAKING|breaking change)" | sed ' s/^[a-f0-9]* //' )
182
+ # Collect commits from all repositories
183
+ for repo in " ${ALL_REPOS[@]} " ; do
184
+ if [ -d " $repo " ]; then
185
+ repo_name=$( basename " $repo " )
186
+ echo -e " Analyzing $repo_name ..."
187
+
188
+ # Features
189
+ repo_features=$( get_commits_from_repo " $repo " " ^[a-f0-9]+ feat:" | sed " s/^[a-f0-9]* feat: /- [$repo_name ] /" )
190
+ if [ -n " $repo_features " ]; then
191
+ FEATURES=" $FEATURES$repo_features " $' \n '
192
+ fi
193
+
194
+ # Fixes
195
+ repo_fixes=$( get_commits_from_repo " $repo " " ^[a-f0-9]+ fix:" | sed " s/^[a-f0-9]* fix: /- [$repo_name ] /" )
196
+ if [ -n " $repo_fixes " ]; then
197
+ FIXES=" $FIXES$repo_fixes " $' \n '
198
+ fi
199
+
200
+ # Breaking changes
201
+ repo_breaking=$( get_commits_from_repo " $repo " " ^[a-f0-9]+ .*(BREAKING|breaking change)" | sed " s/^[a-f0-9]* /- [$repo_name ] /" )
202
+ if [ -n " $repo_breaking " ]; then
203
+ BREAKING=" $BREAKING$repo_breaking " $' \n '
204
+ fi
205
+
206
+ # Performance improvements
207
+ repo_perf=$( get_commits_from_repo " $repo " " ^[a-f0-9]+ perf:" | sed " s/^[a-f0-9]* perf: /- [$repo_name ] /" )
208
+ if [ -n " $repo_perf " ]; then
209
+ PERF=" $PERF$repo_perf " $' \n '
210
+ fi
211
+
212
+ # API changes
213
+ repo_api=$( get_commits_from_repo " $repo " " (api|endpoint|/write|/query|/ping|/health|/metrics|v1|v2|v3)" | sed " s/^[a-f0-9]* /- [$repo_name ] /" )
214
+ if [ -n " $repo_api " ]; then
215
+ API_CHANGES=" $API_CHANGES$repo_api " $' \n '
216
+ fi
217
+ fi
218
+ done
47
219
48
- # Performance improvements
49
- echo -e " \n${GREEN} Performance:${NC} "
50
- PERF=$( git -C " $REPO_PATH " log --format=" %h %s" " ${FROM_VERSION} ..${TO_VERSION} " | grep -E " ^[a-f0-9]+ perf:" | sed ' s/^[a-f0-9]* perf: //' )
220
+ # Analyze API changes in detail
221
+ echo -e " \n${YELLOW} Analyzing HTTP API changes...${NC} "
222
+ for repo in " ${ALL_REPOS[@]} " ; do
223
+ repo_name=$( basename " $repo " )
224
+ analyze_api_changes " $repo " " $repo_name "
225
+ done
51
226
52
227
# Generate markdown output
53
228
OUTPUT_FILE=" release-notes-${TO_VERSION} .md"
60
235
61
236
# Add features
62
237
if [ -n " $FEATURES " ]; then
63
- while IFS= read -r line; do
64
- PR=$( extract_pr_number " $line " )
65
- # Clean up the commit message
66
- CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
67
- if [ -n " $PR " ]; then
68
- echo " - $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
69
- else
70
- echo " - $CLEAN_LINE " >> " $OUTPUT_FILE "
238
+ echo " $FEATURES " | while IFS= read -r line; do
239
+ if [ -n " $line " ]; then
240
+ PR=$( extract_pr_number " $line " )
241
+ # Clean up the commit message
242
+ CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
243
+ if [ -n " $PR " ]; then
244
+ echo " $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
245
+ else
246
+ echo " $CLEAN_LINE " >> " $OUTPUT_FILE "
247
+ fi
71
248
fi
72
- done <<< " $FEATURES "
249
+ done
73
250
else
74
251
echo " - No new features in this release" >> " $OUTPUT_FILE "
75
252
fi
@@ -82,15 +259,17 @@ cat >> "$OUTPUT_FILE" << EOF
82
259
EOF
83
260
84
261
if [ -n " $FIXES " ]; then
85
- while IFS= read -r line; do
86
- PR=$( extract_pr_number " $line " )
87
- CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
88
- if [ -n " $PR " ]; then
89
- echo " - $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
90
- else
91
- echo " - $CLEAN_LINE " >> " $OUTPUT_FILE "
262
+ echo " $FIXES " | while IFS= read -r line; do
263
+ if [ -n " $line " ]; then
264
+ PR=$( extract_pr_number " $line " )
265
+ CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
266
+ if [ -n " $PR " ]; then
267
+ echo " $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
268
+ else
269
+ echo " $CLEAN_LINE " >> " $OUTPUT_FILE "
270
+ fi
92
271
fi
93
- done <<< " $FIXES "
272
+ done
94
273
else
95
274
echo " - No bug fixes in this release" >> " $OUTPUT_FILE "
96
275
fi
@@ -102,15 +281,17 @@ if [ -n "$BREAKING" ]; then
102
281
### Breaking Changes
103
282
104
283
EOF
105
- while IFS= read -r line; do
106
- PR=$( extract_pr_number " $line " )
107
- CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
108
- if [ -n " $PR " ]; then
109
- echo " - $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
110
- else
111
- echo " - $CLEAN_LINE " >> " $OUTPUT_FILE "
284
+ echo " $BREAKING " | while IFS= read -r line; do
285
+ if [ -n " $line " ]; then
286
+ PR=$( extract_pr_number " $line " )
287
+ CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
288
+ if [ -n " $PR " ]; then
289
+ echo " $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
290
+ else
291
+ echo " $CLEAN_LINE " >> " $OUTPUT_FILE "
292
+ fi
112
293
fi
113
- done <<< " $BREAKING "
294
+ done
114
295
fi
115
296
116
297
# Add performance improvements if any
@@ -120,16 +301,54 @@ if [ -n "$PERF" ]; then
120
301
### Performance Improvements
121
302
122
303
EOF
123
- while IFS= read -r line; do
124
- PR=$( extract_pr_number " $line " )
125
- CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
126
- if [ -n " $PR " ]; then
127
- echo " - $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
128
- else
129
- echo " - $CLEAN_LINE " >> " $OUTPUT_FILE "
304
+ echo " $PERF " | while IFS= read -r line; do
305
+ if [ -n " $line " ]; then
306
+ PR=$( extract_pr_number " $line " )
307
+ CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
308
+ if [ -n " $PR " ]; then
309
+ echo " $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
310
+ else
311
+ echo " $CLEAN_LINE " >> " $OUTPUT_FILE "
312
+ fi
130
313
fi
131
- done <<< " $PERF "
314
+ done
132
315
fi
133
316
317
+ # Add HTTP API changes if any
318
+ if [ -n " $API_CHANGES " ]; then
319
+ cat >> " $OUTPUT_FILE " << EOF
320
+
321
+ ### HTTP API Changes
322
+
323
+ EOF
324
+ echo " $API_CHANGES " | while IFS= read -r line; do
325
+ if [ -n " $line " ]; then
326
+ PR=$( extract_pr_number " $line " )
327
+ CLEAN_LINE=$( echo " $line " | sed -E ' s/ \(#[0-9]+\)$//' )
328
+ if [ -n " $PR " ]; then
329
+ echo " $CLEAN_LINE ([#$PR ](https://github.com/influxdata/influxdb/pull/$PR ))" >> " $OUTPUT_FILE "
330
+ else
331
+ echo " $CLEAN_LINE " >> " $OUTPUT_FILE "
332
+ fi
333
+ fi
334
+ done
335
+ fi
336
+
337
+ # Add API analysis summary
338
+ cat >> " $OUTPUT_FILE " << EOF
339
+
340
+ ### API Analysis Summary
341
+
342
+ The following endpoints may have been affected in this release:
343
+ - v1 API endpoints: \` /write\` , \` /query\` , \` /ping\`
344
+ - v2 API endpoints: \` /api/v2/write\` , \` /api/v2/query\`
345
+ - v3 API endpoints: \` /api/v3/*\`
346
+ - System endpoints: \` /health\` , \` /metrics\`
347
+
348
+ Please review the commit details above and consult the API documentation for specific changes.
349
+
350
+ EOF
351
+
134
352
echo -e " \n${GREEN} Release notes generated in: ${OUTPUT_FILE}${NC} "
135
- echo -e " ${YELLOW} Please review and edit the generated notes before adding to documentation.${NC} "
353
+ echo -e " ${YELLOW} Please review and edit the generated notes before adding to documentation.${NC} "
354
+ echo -e " ${BLUE} API changes have been automatically detected and included.${NC} "
0 commit comments