| |
@@ -17,6 +17,28 @@
|
| |
_log = logging.getLogger(__name__)
|
| |
|
| |
|
| |
+ def blocking_issues(tags):
|
| |
+ """Lists blocking issues we track in the fedora-infrastructure project.
|
| |
+ """
|
| |
+ if not tags:
|
| |
+ print(f"No tags to filter blocking issues by, returning empty.")
|
| |
+ return []
|
| |
+ api = f"https://pagure.io/api/0/fedora-infrastructure/issues"
|
| |
+ q = f"?status=Open&tags={tags[0]}"
|
| |
+ issues = []
|
| |
+ try:
|
| |
+ r = requests.get(api + q)
|
| |
+ issues = r.json()['issues']
|
| |
+ if tags:
|
| |
+ t = set(tags[1:])
|
| |
+ issues = [i for i in issues if t & set(i['tags'])]
|
| |
+ for i in issues:
|
| |
+ print(f"Found blocking issue https://pagure.io/fedora-infrastructure/issue/{i['id']}")
|
| |
+ except Exception as e:
|
| |
+ print(f"Error when querying pagure for blocking issues: {e}")
|
| |
+ return issues
|
| |
+
|
| |
+
|
| |
class MonitoringException(Exception):
|
| |
"""The base class for all exceptions raised by this script."""
|
| |
|
| |
@@ -45,7 +67,6 @@
|
| |
self.logs.append(f"{time} - {content}")
|
| |
print(f"{time} - {content}", end=end, flush=True)
|
| |
|
| |
-
|
| |
def clone_repo(self, command, namespace, name, folder):
|
| |
""" Clone the specified git repo into the specified folder.
|
| |
"""
|
| |
@@ -66,7 +87,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def add_remote(self, name, url, folder):
|
| |
""" Add the specified remote to the git repo in the folder with the
|
| |
specified url.
|
| |
@@ -79,7 +99,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def switch_branch(self, command, name, folder):
|
| |
""" Switch to the specified git branch in the specified git repo.
|
| |
"""
|
| |
@@ -91,7 +110,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def bump_release(self, name, folder):
|
| |
""" Bump the release of the spec file the specified git repo.
|
| |
"""
|
| |
@@ -103,7 +121,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def commit_changes(self, commit_log, folder):
|
| |
""" Commit all the changes made to *tracked* files in the git repo
|
| |
with the specified commit log.
|
| |
@@ -116,7 +133,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def push_changes(self, folder, target, branch, force=False):
|
| |
""" Push all changes using git.
|
| |
"""
|
| |
@@ -131,7 +147,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def pull_changes(self, folder, target, branch):
|
| |
""" Pull all changes using git.
|
| |
"""
|
| |
@@ -144,7 +159,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def open_pullrequest(self, base_url, username, namespace, name, branch, token):
|
| |
""" Open a pull-request from the user's fork to the main project for
|
| |
the specified branch.
|
| |
@@ -182,7 +196,6 @@
|
| |
self.print_user(info_log, success=success)
|
| |
return (success, pr_id, pr_uid)
|
| |
|
| |
-
|
| |
def get_nevr(self, command, folder):
|
| |
""" Get the name-epoch-version-release presently in git
|
| |
"""
|
| |
@@ -195,7 +208,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def build_package(self, command, folder, target=None):
|
| |
""" Build the package in the current branch
|
| |
"""
|
| |
@@ -210,7 +222,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def chain_build_packages(self, command, packages, folder, target=None):
|
| |
""" Chain-build the packages in the current branch
|
| |
"""
|
| |
@@ -228,7 +239,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def get_build_tags(self, koji_url, nevr, expected_ends):
|
| |
""" List the tags associated with the specified build.
|
| |
"""
|
| |
@@ -292,7 +302,6 @@
|
| |
info_log = f"Retrieving koji tags: {tags}"
|
| |
self.print_user(info_log, success=success)
|
| |
|
| |
-
|
| |
def create_update(self, command, item, prod=True, username=None, password=None, from_tag=False):
|
| |
""" Create the update for the package built.
|
| |
"""
|
| |
@@ -324,7 +333,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def get_update_id(self, nevr, url):
|
| |
""" Retrieve the update identifier from bodhi for the given nevr. """
|
| |
start = datetime.datetime.utcnow()
|
| |
@@ -352,7 +360,6 @@
|
| |
self.print_user(info_log, success=success)
|
| |
return updateid
|
| |
|
| |
-
|
| |
def lookup_results_datagrepper(
|
| |
self, base_url, name, topic, nevr=None, nevrs=None, rev=None,
|
| |
bodhi_id=None, start=None, duration=15
|
| |
@@ -405,8 +412,8 @@
|
| |
|
| |
# New message format from the CI pipeline for koji builds
|
| |
if (
|
| |
- "ci.koji-build" in message["topic"] and
|
| |
- message["msg"]["artifact"]["nvr"] == nevr
|
| |
+ "ci.koji-build" in message["topic"]
|
| |
+ and message["msg"]["artifact"]["nvr"] == nevr
|
| |
):
|
| |
if message["topic"].endswith("test.complete"):
|
| |
success = True
|
| |
@@ -451,9 +458,8 @@
|
| |
if (
|
| |
"greenwave" in message["topic"]
|
| |
and (
|
| |
- message["msg"]["subject_identifier"] == nevr
|
| |
- or
|
| |
- message["msg"]["subject_identifier"] in nevrs
|
| |
+ message["msg"]["subject_identifier"] == nevr
|
| |
+ or message["msg"]["subject_identifier"] in nevrs
|
| |
)
|
| |
):
|
| |
success = True
|
| |
@@ -464,9 +470,8 @@
|
| |
if (
|
| |
"waiverdb" in message["topic"]
|
| |
and (
|
| |
- message["msg"]["subject_identifier"] == nevr
|
| |
- or
|
| |
- message["msg"]["subject_identifier"] in nevrs
|
| |
+ message["msg"]["subject_identifier"] == nevr
|
| |
+ or message["msg"]["subject_identifier"] in nevrs
|
| |
)
|
| |
):
|
| |
success = True
|
| |
@@ -501,7 +506,6 @@
|
| |
info_log += f" - ran for: {(end - start).seconds}s"
|
| |
self.print_user(info_log, success=success)
|
| |
|
| |
-
|
| |
def lookup_ci_resultsdb(self, nevr, name, url):
|
| |
""" Check the CI results in the specified resultsdb for results about
|
| |
our specified build.
|
| |
@@ -549,7 +553,6 @@
|
| |
info_log += f" - ran for: {(end - start).seconds}s"
|
| |
self.print_user(info_log, success=success)
|
| |
|
| |
-
|
| |
def waive_update(self, command, updateid, prod=True, username=None, password=None):
|
| |
""" Waive all the tests results for the specified update using bodhi's
|
| |
CLI.
|
| |
@@ -576,7 +579,6 @@
|
| |
except MonitoringException:
|
| |
self.print_user(info_log, success=False)
|
| |
|
| |
-
|
| |
def get_pr_flag(
|
| |
self,
|
| |
base_url,
|
| |
@@ -630,7 +632,6 @@
|
| |
|
| |
self.print_user(info_log, success=success)
|
| |
|
| |
-
|
| |
def merge_pr(self, base_url, username, namespace, name, pr_id, token):
|
| |
""" Merge the specified PR
|
| |
"""
|
| |
@@ -650,7 +651,6 @@
|
| |
|
| |
self.print_user(info_log, success=success)
|
| |
|
| |
-
|
| |
def finalize(self, start):
|
| |
""" End data returned. """
|
| |
end = datetime.datetime.utcnow()
|
| |
@@ -675,7 +675,6 @@
|
| |
self.print_user(info_log, success=False)
|
| |
return side_tag_name
|
| |
|
| |
-
|
| |
def clone_and_bump(self, folder, nevrs, conf, name, target=None, new_side_tag=False):
|
| |
"""Clone the repo, bump the release, commit and push."""
|
| |
namespace = conf["namespace"]
|
| |
Currently just Pagure issues, because that is the one issue that is blocking us :)