]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build/ops: ceph-release-notes guess pr title based on gh tags 11399/head
authorAbhishek Lekshmanan <alekshmanan@suse.com>
Mon, 10 Oct 2016 19:37:03 +0000 (21:37 +0200)
committerAbhishek Lekshmanan <alekshmanan@suse.com>
Mon, 10 Oct 2016 19:59:56 +0000 (21:59 +0200)
We add a switch --use-tags which helps guess the component of the pr
based on gh tags, still needs work, but provides better estimates when
looking at really large release notes where guessing each pr would be
too much work

Signed-off-by: Abhishek Lekshmanan <alekshmanan@suse.com>
src/script/ceph-release-notes

index ea7125aa64875415fe40c38b171aadc1404cba80..77bb9dfbe36bfa79bc669026efd3261b91549a90 100755 (executable)
@@ -70,8 +70,24 @@ def get_original_issue(issue, verbose):
             print ("http://tracker.ceph.com/issues/" + issue + " has no copied_to relations, do not look for the original issue")
         return issue
 
+def split_component(title,gh,number):
+    title_re = '(bluestore|build/ops|cephfs|cmake|core|common|crush|cli|doc|fs|librados|mds|mon|msgr|mgr|osd|log|librbd|rbd|objecter|pybind|rgw|tests|tools)(:.*)'
+    match = re.match(title_re, title)
+    if match:
+        return match.group(1)+match.group(2)
+    else:
+        issue = gh.repos("ceph")("ceph").issues(number).get()
+        labels = {it['name'] for it in issue['labels']}
+        if 'documentation' in labels:
+            return 'doc: '+ title
+        item = {'bluestore','build/ops','cephfs','common','core','fs','mgr','pybind','rgw','rbd'}.intersection(labels)
+        if item:
+            return ",".join(item)+': '+title
+        else:
+            return 'UNKNOWN: '+ title
+
 
-def make_release_notes(gh, repo, ref, plaintext, verbose, strict):
+def make_release_notes(gh, repo, ref, plaintext, verbose, strict, use_tags):
 
     issue2prs = {}
     pr2issues = {}
@@ -132,6 +148,8 @@ def make_release_notes(gh, repo, ref, plaintext, verbose, strict):
                     print ("ERROR: http://github.com/ceph/ceph/pull/" + str(number) + " title " + title.encode("utf-8") + " does not match " + title_re)
                 else:
                     title = match.group(1) + match.group(2)
+            if use_tags:
+                title = split_component(title,gh,number)
 
             pr2info[number] = (author, title, message)
 
@@ -188,14 +206,16 @@ if __name__ == "__main__":
                         help="verbose")
     parser.add_argument("--strict",
                         action='store_true', default=None,
-                        help="strict")
+                        help="strict, recommended only for backport releases")
     parser.add_argument("repo", metavar="repo",
                         help="path to ceph git repo")
     parser.add_argument("--token", default=os.getenv("GITHUB_ACCESS_TOKEN"),
                         help="Github Access Token ($GITHUB_ACCESS_TOKEN otherwise)")
+    parser.add_argument("--use-tags", default=False,
+                        help="Use github tags to guess the component")
 
     args = parser.parse_args()
     gh = github.GitHub(
         access_token=args.token)
 
-    make_release_notes(gh, Repo(args.repo), args.rev, args.text, args.verbose, args.strict)
+    make_release_notes(gh, Repo(args.repo), args.rev, args.text, args.verbose, args.strict, args.use_tags)