]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script: fix release notes script to include cherry-picks
authorLaura Flores <lflores@redhat.com>
Tue, 11 Apr 2023 17:58:44 +0000 (17:58 +0000)
committerLaura Flores <lflores@redhat.com>
Tue, 11 Apr 2023 17:58:44 +0000 (17:58 +0000)
There is a new parameter (`--cherry_picks`, `-c`) added to the
ceph-release-notes script that allows the user to input a list of PR numbers
associated with last-minute cherry-picks.

```
$ LANG=en_US.UTF-8 python3 ceph-release-notes -h
usage: ceph-release-notes [-h] [--rev REV] [--cherry_picks CHERRY_PICKS]
                          [--text] [--html] [--markdown] [--verbose]
                          [--strict] [--token TOKEN] [--use-tags USE_TAGS]
                          [--include-pr-messages]
                          repo

    Make ceph release notes for a given revision. Eg usage:

    $ ceph-release-notes -r tags/v0.87..origin/giant         $(git rev-parse --show-toplevel)

    It is recommended to set the github env. token in order to avoid
    hitting the api rate limits.

positional arguments:
  repo                  path to ceph git repo

optional arguments:
  -h, --help            show this help message and exit
  --rev REV, -r REV     git revision range for creating release notes
  --cherry_picks CHERRY_PICKS, -c CHERRY_PICKS
                        PRs associated with any last-minute cherry-picks. Provide PR numbers as a string separated by commas, i.e. '50575,50625'
  --text, -t            output plain text only, no links
  --html                output html format for (old wordpress) website blog
  --markdown            output markdown format for new ceph.io blog
  --verbose, -v         verbose
  --strict              strict, recommended only for backport releases
  --token TOKEN         Github Access Token ($GITHUB_ACCESS_TOKEN otherwise)
  --use-tags USE_TAGS   Use github tags to guess the component
  --include-pr-messages
                        Include full PR message in addition to PR title, if available
```

Signed-off-by: Laura Flores <lflores@redhat.com>
src/script/ceph-release-notes

index 0d6024581aec3b23a74cc88f8c6674e14aab1ec7..532743179ceb5a419f78fbedc2d6e14cfcdfc7ac 100755 (executable)
@@ -51,7 +51,7 @@ prefixes = ['bluestore', 'build/ops', 'cephfs', 'cephx', 'cli', 'cmake',
 signed_off_re = re.compile("Signed-off-by: (.+) <")
 tracker_re = re.compile("http://tracker.ceph.com/issues/(\d+)")
 rst_link_re = re.compile(r"([a-zA-Z0-9])_(\W)")
-release_re = re.compile(r"^(nautilus|octopus|pacific|quincy):\s*")
+release_re = re.compile(r"^(nautilus|octopus|pacific|Pacific|quincy|Quincy|reef|Reef):\s*")
 
 tracker_uri = "http://tracker.ceph.com/issues/{0}.json"
 
@@ -144,17 +144,24 @@ def _title_message(commit, pr, strict):
     message = "    " + "\n    ".join(lines)
     return (title, message)
 
-def make_release_notes(gh, repo, ref, plaintext, html, markdown, verbose, strict, use_tags, include_pr_messages):
+def make_release_notes(gh, repo, ref, cherry_picks, plaintext, html, markdown, verbose, strict, use_tags, include_pr_messages):
 
     issue2prs = {}
     pr2issues = {}
     pr2info = {}
 
+    merges = []
     for commit in repo.iter_commits(ref, merges=True):
         merge = merge_re.match(commit.summary)
         if not merge:
             continue
-        number = merge.group(2)
+        PR = merge.group(2)
+        merges.append(PR)
+    if cherry_picks:
+        for PR in cherry_picks.split(','):
+            merges.append(PR)
+
+    for number in merges:
         print ("Considering PR#" + number)
         # do not pick up ceph/ceph-qa-suite.git PRs
         if int(number) < 1311:
@@ -330,6 +337,8 @@ if __name__ == "__main__":
 
     parser.add_argument("--rev", "-r",
                         help="git revision range for creating release notes")
+    parser.add_argument("--cherry_picks", "-c",
+                        help="PRs associated with any last-minute cherry-picks. Provide PR numbers as a string separated by commas, i.e. '50575,50625'")
     parser.add_argument("--text", "-t",
                         action='store_true', default=None,
                         help="output plain text only, no links")
@@ -365,6 +374,7 @@ if __name__ == "__main__":
         gh,
         Repo(args.repo),
         args.rev,
+        args.cherry_picks,
         args.text,
         args.html,
         args.markdown,