From 4d5cb5c85210013525de0048bf86312a6cc5b0e0 Mon Sep 17 00:00:00 2001 From: Abhishek Lekshmanan Date: Mon, 10 Oct 2016 21:37:03 +0200 Subject: [PATCH] build/ops: ceph-release-notes guess pr title based on gh tags 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 --- src/script/ceph-release-notes | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/script/ceph-release-notes b/src/script/ceph-release-notes index ea7125aa6487..77bb9dfbe36b 100755 --- a/src/script/ceph-release-notes +++ b/src/script/ceph-release-notes @@ -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) -- 2.47.3