]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
backport-resolve-issue: narrow regular expression
authorNathan Cutler <ncutler@suse.com>
Wed, 13 Nov 2019 10:37:15 +0000 (11:37 +0100)
committerNathan Cutler <ncutler@suse.com>
Mon, 18 Nov 2019 13:13:00 +0000 (14:13 +0100)
The regular expression used to extract tracker URLs from the PR body
was too generous. When there are two URLs on the same line and the
second is a tracker URl, the regex picked up both of them. For example,
the following string matched the regex:

"https://github.com/ceph/ceph/pull/26538, https://tracker.ceph.com/issues/41452"

This commit fixes the issue.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
src/script/backport-resolve-issue

index 2b4626595c1361ba78050e9c5d7222cb4de64e43..a089aca3ed5feefaba35217a9f2e37c353c9b3b1 100755 (executable)
@@ -393,7 +393,7 @@ Ceph version:     base {}, target {}'''.format(self.github_url, pr_title_trunc,
         #
         for bt in self.backport_trackers:
             # does the Backport Tracker description link back to the GitHub PR?
-            p = re.compile('http.*://github.com/ceph/ceph/pull/\\d+')
+            p = re.compile('http.?://github.com/ceph/ceph/pull/\\d+')
             bt.tracker_description = bt.redmine_issue.description
             bt.github_url_from_tracker = None
             try:
@@ -487,7 +487,7 @@ Ceph version:     base {}, target {}'''.format(self.github_url, pr_title_trunc,
 
     def extract_backport_trackers_from_github_pr_desc(self):
         global redmine_endpoint
-        p = re.compile('http.*://tracker.ceph.com/issues/\\d+')
+        p = re.compile('http.?://tracker.ceph.com/issues/\\d+')
         matching_strings = p.findall(self.github_pr_desc)
         if not matching_strings: 
             print_outer_divider()