Skip to content

Commit 007d331

Browse files
Fix: Don't consider "release" issues as release-blocking
1 parent f7e6718 commit 007d331

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

etc/make_release.py

+18-12
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@
4242
import subprocess
4343
import sys
4444
import tempfile
45+
from typing import Iterable
4546

46-
import click # pip install Click
47-
from git import Repo # pip install GitPython
48-
from github import Github # pip install PyGithub
49-
from jira import JIRA # pip install jira
47+
import click # pip install Click
48+
from git import Repo # pip install GitPython
49+
from github import Github # pip install PyGithub
50+
from jira import JIRA, resources # pip install jira
5051
import oauthlib.oauth1
5152

5253
if sys.version_info < (3, 0, 0):
@@ -454,21 +455,26 @@ def get_all_issues_for_version(auth_jira, release_version):
454455
.format(str(CXX_PROJ_ID), release_version)
455456
return auth_jira.search_issues(jql_query, maxResults=0)
456457

457-
def all_issues_closed(issues):
458+
def all_issues_closed(issues: Iterable[resources.Issue]) -> bool:
458459
"""
459460
Check to ensure that all issues are 'Closed'. Produce appropriate error
460461
message(s) and return False if any open issues are found.
461462
"""
462463

463-
status_set = set(i.fields.status.name for i in issues)
464+
open_nonrelease_tickets = {
465+
iss
466+
for iss in issues
467+
# Don't include "release", as those are open until the release is done
468+
if "release" not in iss.fields.labels
469+
# Only include issues that are not marked as "closed"
470+
and iss.fields.status.name != "Closed"
471+
}
464472

465-
if status_set.difference({'Closed'}):
466-
msg = 'Open tickets found. Cannot release!'
467-
msg += '\nThe following open tickets were found:'
473+
if open_nonrelease_tickets:
474+
msg = "Open tickets found. Cannot release!"
475+
msg += "\nThe following open tickets were found:"
468476
click.echo(msg, err=True)
469-
open_filter = lambda x: x.fields.status.name != 'Closed'
470-
open_issues = [i.key for i in filter(open_filter, issues)]
471-
click.echo('{}'.format(", ".join(open_issues)), err=True)
477+
click.echo("\n".join(f" - {iss.key}" for iss in open_nonrelease_tickets), err=True)
472478
return False
473479

474480
return True

0 commit comments

Comments
 (0)