Skip to content

Commit 6fdfad2

Browse files
committed
MXS Add scripts for generating release notes
1 parent 39aa57c commit 6fdfad2

File tree

3 files changed

+188
-0
lines changed

3 files changed

+188
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#!/bin/bash
2+
3+
if [ "$1" == "" ]
4+
then
5+
echo "usage: $0 major.minor.patch [maturity]"
6+
exit 1
7+
fi
8+
9+
VERSION=$1
10+
11+
patch=${VERSION##*.}
12+
major_minor=${VERSION%.*}
13+
major=${major_minor%%.*}
14+
minor=${major_minor##*.}
15+
16+
if [ "$2" == "" ]
17+
then
18+
echo "No maturity specified, assuming GA."
19+
maturity="GA"
20+
else
21+
maturity=$2
22+
fi
23+
24+
if [ ! -d "$major_minor" ]
25+
then
26+
echo "error: $major_minor does not exist or is not a directory."
27+
exit 1
28+
fi
29+
30+
# Script location
31+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
32+
33+
output=$major.$minor/$VERSION.md
34+
35+
echo Creating/overwriting $output.
36+
echo
37+
38+
# For version 6, this is just the major version. For other versions, it
39+
# is $major.$minor. Needs to be updated whenever a new major release is
40+
# out or if the versioning scheme for MaxScale changes.
41+
upgrade_version="$major.$minor"
42+
43+
cat <<EOF > $output
44+
# MariaDB MaxScale ${VERSION} Release Notes
45+
46+
Release ${VERSION} is a ${maturity} release.
47+
48+
This document describes the changes in release ${VERSION}, when compared to the
49+
previous release in the same series.
50+
51+
If you are upgrading from an older major version of MaxScale, please read the
52+
[upgrading document](https://app.gitbook.com/s/0pSbu5DcMSW4KwAkUcmX/maxscale-management/deployment/upgrading-maxscale)
53+
for this MaxScale version.
54+
55+
For any problems you encounter, please consider submitting a bug
56+
report on [our Jira](https://jira.mariadb.org/projects/MXS).
57+
58+
`${SCRIPT_DIR}/list_fixed.sh ${VERSION}`
59+
60+
## Known Issues and Limitations
61+
62+
There are some limitations and known issues within this version of MaxScale.
63+
For more information, please refer to the
64+
[Limitations](https://app.gitbook.com/s/0pSbu5DcMSW4KwAkUcmX/maxscale-management/mariadb-maxscale-limitations-guide)
65+
document.
66+
67+
## Packaging
68+
69+
RPM and Debian packages are provided for the supported Linux distributions.
70+
71+
Packages can be downloaded [here](https://mariadb.com/downloads).
72+
73+
## Source Code
74+
75+
The source code of MaxScale is tagged at GitHub with a tag, which is identical
76+
with the version of MaxScale. For instance, the tag of version X.Y.Z of MaxScale
77+
is \`maxscale-X.Y.Z\`. Further, the default branch is always the latest GA version
78+
of MaxScale.
79+
80+
The source code is available [here](https://github.com/mariadb-corporation/MaxScale).
81+
EOF
82+
83+
echo Manually update the following files:
84+
echo - $major.$minor/$major.$minor-changelog.md
85+
echo - ./all-releases.md
86+
echo - ../SUMMARY.md.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
4+
if [ $# -ne 1 ]
5+
then
6+
echo "USAGE: $0 VERSION"
7+
exit 1
8+
fi
9+
10+
# Script location
11+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
12+
13+
version=$1
14+
curl -s "https://jira.mariadb.org/sr/jira.issueviews:searchrequest-csv-all-fields/temp/SearchRequest.csv?jqlQuery=project+%3D+MXS+AND+status+%3D+Closed+AND+fixVersion+%3D+$version" | $DIR/process.py
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/usr/bin/env python3
2+
3+
import sys
4+
import csv
5+
import itertools
6+
7+
# Loop over issues. If an issue has a label that starts with 'CVE-',
8+
# assume the label is a CVE id. If an issue has multiple CVE labels,
9+
# the issue will be added multiple times (by design).
10+
#
11+
def find_cves(issues):
12+
cves=[]
13+
14+
for i in issues:
15+
labels_field = i.get('Labels')
16+
if labels_field:
17+
labels=labels_field.split(',')
18+
for label in labels:
19+
if label[0:4].upper() == 'CVE-':
20+
cve = {};
21+
cve['Id'] = label
22+
cve['Issue'] = i
23+
cves.append(cve)
24+
25+
return cves
26+
27+
def print_cves(header, cves):
28+
print(header)
29+
print()
30+
31+
for cve in cves:
32+
id = cve['Id']
33+
i = cve['Issue']
34+
print("* [" + id + "](https://www.cve.org/CVERecord?id=" + id + ") Fixed by [" + i['Issue key'] + "](https://jira.mariadb.org/browse/" + i['Issue key'] + ") " + i['Summary'])
35+
36+
print()
37+
38+
39+
bugs = []
40+
new_features = []
41+
tasks = []
42+
43+
reader = csv.reader(sys.stdin.readlines())
44+
field_names = next(reader)
45+
46+
for row in reader:
47+
# In case there are multiple values of a particular field, collect
48+
# all values separated by a ','.
49+
groups = itertools.groupby(zip(field_names, row), key=lambda x: x[0])
50+
row = dict([(k, ','.join([v[1] for v in g])) for k, g in groups])
51+
52+
if row['Issue Type'] == 'Bug':
53+
bugs.append(row)
54+
elif row['Issue Type'] == 'New Feature':
55+
new_features.append(row)
56+
elif row['Issue Type'] == 'Task':
57+
tasks.append(row)
58+
59+
# Check if some bug-fix fixes a CVE. These are assumed to be CVEs of MaxScale.
60+
cves = find_cves(bugs)
61+
62+
if len(cves) > 0:
63+
print_cves("## CVEs resolved.", cves)
64+
65+
# If there are tasks, check if any of them fixes a CVE, which is assumed
66+
# to be a non-MaxScale one; e.g. a CVE of an external library.
67+
if len(tasks) > 0:
68+
cves = find_cves(tasks)
69+
70+
if len(cves) > 0:
71+
print_cves("## External CVEs resolved.", cves)
72+
73+
if len(new_features) > 0:
74+
print("## New Features")
75+
print()
76+
77+
for f in new_features:
78+
print("* [" + f['Issue key'] + "](https://jira.mariadb.org/browse/" + f['Issue key'] + ") " + f['Summary'])
79+
print()
80+
81+
82+
print("## Bug fixes")
83+
print()
84+
85+
for b in bugs:
86+
print("* [" + b['Issue key'] + "](https://jira.mariadb.org/browse/" + b['Issue key'] + ") " + b['Summary'])
87+
88+
print()

0 commit comments

Comments
 (0)