| |
@@ -28,12 +28,14 @@
|
| |
issues = []
|
| |
try:
|
| |
r = requests.get(api + q)
|
| |
- issues = r.json()['issues']
|
| |
+ issues = r.json()["issues"]
|
| |
if tags:
|
| |
t = set(tags[1:])
|
| |
- issues = [i for i in issues if t & set(i['tags'])]
|
| |
+ 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']}")
|
| |
+ 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
|
| |
@@ -44,7 +46,6 @@
|
| |
|
| |
|
| |
class MonitoringUtils:
|
| |
-
|
| |
def __init__(self):
|
| |
""" Instanciate the object. """
|
| |
self.logs = []
|
| |
@@ -76,11 +77,13 @@
|
| |
info_log = f"Cloning as {username} the git repo: {namespace}/{name}"
|
| |
self.print_user(info_log)
|
| |
try:
|
| |
- run_command([command, "--user", username, "clone", f"{namespace}/{name}"], cwd=folder)
|
| |
+ run_command(
|
| |
+ [command, "--user", username, "clone", f"{namespace}/{name}"],
|
| |
+ cwd=folder,
|
| |
+ )
|
| |
clone_folder = os.path.join(folder, name)
|
| |
run_command(
|
| |
- ["git", "config", "user.name", "packagerbot"],
|
| |
- cwd=clone_folder,
|
| |
+ ["git", "config", "user.name", "packagerbot"], cwd=clone_folder,
|
| |
)
|
| |
run_command(
|
| |
["git", "config", "user.email", "admin@fedoraproject.org"],
|
| |
@@ -169,7 +172,7 @@
|
| |
info_log = f"Creating PR from forks/{username}/{namespace}/{name}"
|
| |
self.print_user(info_log)
|
| |
url = "/".join(
|
| |
- [base_url.rstrip("/"), "api/0", namespace, name, "pull-request/new"]
|
| |
+ [base_url.rstrip("/"), "api/0", namespace, name, "pull-request/new",]
|
| |
)
|
| |
data = {
|
| |
"branch_to": branch,
|
| |
@@ -230,7 +233,9 @@
|
| |
"""
|
| |
if not isinstance(packages, list):
|
| |
packages = [packages]
|
| |
- info_log = f"Chain-building the packages: {packages + [os.path.basename(folder)]}"
|
| |
+ info_log = (
|
| |
+ f"Chain-building the packages: {packages + [os.path.basename(folder)]}"
|
| |
+ )
|
| |
self.print_user(info_log)
|
| |
command = [command, "chain-build"]
|
| |
command.extend(packages)
|
| |
@@ -253,15 +258,10 @@
|
| |
"koji",
|
| |
]
|
| |
if koji_url:
|
| |
- command.extend([
|
| |
- "-s",
|
| |
- koji_url,
|
| |
- ])
|
| |
- command.extend([
|
| |
- "call",
|
| |
- "listTags",
|
| |
- nevr
|
| |
- ])
|
| |
+ command.extend(
|
| |
+ ["-s", koji_url,]
|
| |
+ )
|
| |
+ command.extend(["call", "listTags", nevr])
|
| |
|
| |
success = False
|
| |
tags = None
|
| |
@@ -269,7 +269,7 @@
|
| |
while True:
|
| |
try:
|
| |
output = run_command(command)
|
| |
- output = output.decode('utf-8')
|
| |
+ output = output.decode("utf-8")
|
| |
try:
|
| |
data = ast.literal_eval(output.strip())
|
| |
except Exception:
|
| |
@@ -305,7 +305,9 @@
|
| |
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):
|
| |
+ def create_update(
|
| |
+ self, command, item, prod=True, username=None, password=None, from_tag=False,
|
| |
+ ):
|
| |
""" Create the update for the package built.
|
| |
"""
|
| |
info_log = f"Creating a bodhi update"
|
| |
@@ -364,8 +366,16 @@
|
| |
return updateid
|
| |
|
| |
def lookup_results_datagrepper(
|
| |
- self, base_url, name, topic, nevr=None, nevrs=None, rev=None,
|
| |
- bodhi_id=None, start=None, duration=15
|
| |
+ self,
|
| |
+ base_url,
|
| |
+ name,
|
| |
+ topic,
|
| |
+ nevr=None,
|
| |
+ nevrs=None,
|
| |
+ rev=None,
|
| |
+ bodhi_id=None,
|
| |
+ start=None,
|
| |
+ duration=15,
|
| |
):
|
| |
""" Check the CI results in datagrepper for results about our specified
|
| |
build.
|
| |
@@ -397,8 +407,8 @@
|
| |
data = requests.get(end_url).json()
|
| |
if "raw_messages" not in data:
|
| |
nomsg_log = f"No messages in data-grepper on {end_url} "
|
| |
- if 'error' in data:
|
| |
- nomsg_log += data['error']
|
| |
+ if "error" in data:
|
| |
+ nomsg_log += data["error"]
|
| |
self.print_user(nomsg_log)
|
| |
break
|
| |
|
| |
@@ -451,42 +461,37 @@
|
| |
if (
|
| |
"resultsdb" in message["topic"]
|
| |
and "nvr" in message["msg"]["data"]
|
| |
- and (nevr in message["msg"]["data"]["nvr"]
|
| |
- or message["msg"]["data"]["nvr"] in nevrs)
|
| |
+ and (
|
| |
+ nevr in message["msg"]["data"]["nvr"]
|
| |
+ or message["msg"]["data"]["nvr"] in nevrs
|
| |
+ )
|
| |
):
|
| |
success = True
|
| |
returned_status = message["msg"]["outcome"]
|
| |
break
|
| |
|
| |
# greenwave messages
|
| |
- if (
|
| |
- "greenwave" in message["topic"]
|
| |
- and (
|
| |
- message["msg"]["subject_identifier"] == nevr
|
| |
- or message["msg"]["subject_identifier"] in nevrs
|
| |
- )
|
| |
+ if "greenwave" in message["topic"] and (
|
| |
+ message["msg"]["subject_identifier"] == nevr
|
| |
+ or message["msg"]["subject_identifier"] in nevrs
|
| |
):
|
| |
success = True
|
| |
returned_status = message["msg"]["policies_satisfied"]
|
| |
break
|
| |
|
| |
# waiverdb messages
|
| |
- if (
|
| |
- "waiverdb" in message["topic"]
|
| |
- and (
|
| |
- message["msg"]["subject_identifier"] == nevr
|
| |
- or message["msg"]["subject_identifier"] in nevrs
|
| |
- )
|
| |
+ if "waiverdb" in message["topic"] and (
|
| |
+ message["msg"]["subject_identifier"] == nevr
|
| |
+ or message["msg"]["subject_identifier"] in nevrs
|
| |
):
|
| |
success = True
|
| |
returned_status = ""
|
| |
break
|
| |
|
| |
# bodhi messages
|
| |
- if (
|
| |
- "bodhi.update.status.testing" in message["topic"]
|
| |
- and message["msg"]["artifact"]["id"].startswith(bodhi_id)
|
| |
- ):
|
| |
+ if "bodhi.update.status.testing" in message["topic"] and message[
|
| |
+ "msg"
|
| |
+ ]["artifact"]["id"].startswith(bodhi_id):
|
| |
success = True
|
| |
returned_status = ""
|
| |
break
|
| |
@@ -544,7 +549,9 @@
|
| |
|
| |
if (datetime.datetime.utcnow() - start).seconds > (15 * 60):
|
| |
success = False
|
| |
- info_log = f"CI results did not show in {name} for {nevr} within 15 minutes"
|
| |
+ info_log = (
|
| |
+ f"CI results did not show in {name} for {nevr} within 15 minutes"
|
| |
+ )
|
| |
break
|
| |
|
| |
# Only query datagrepper every 30 seconds
|
| |
@@ -679,18 +686,16 @@
|
| |
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):
|
| |
+ 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"]
|
| |
branch = conf["branch"]
|
| |
|
| |
self.clone_repo(
|
| |
- conf["fedpkg"],
|
| |
- conf["fas_username"],
|
| |
- namespace,
|
| |
- name,
|
| |
- folder=folder,
|
| |
- )
|
| |
+ conf["fedpkg"], conf["fas_username"], namespace, name, folder=folder,
|
| |
+ )
|
| |
gitfolder = os.path.join(folder, name)
|
| |
self.switch_branch(conf["fedpkg"], branch, folder=gitfolder)
|
| |
side_tag_name = None
|
| |
@@ -714,17 +719,13 @@
|
| |
"""
|
| |
output = None
|
| |
try:
|
| |
- output = subprocess.check_output(
|
| |
- command, cwd=cwd, stderr=subprocess.PIPE
|
| |
- )
|
| |
+ output = subprocess.check_output(command, cwd=cwd, stderr=subprocess.PIPE)
|
| |
except subprocess.CalledProcessError as e:
|
| |
if "--password" in command:
|
| |
idx = command.index("--password")
|
| |
command[idx + 1] = "<hidden>"
|
| |
_log.error(
|
| |
- "Command `{}` return code: `{}`".format(
|
| |
- " ".join(command), e.returncode
|
| |
- )
|
| |
+ "Command `{}` return code: `{}`".format(" ".join(command), e.returncode)
|
| |
)
|
| |
_log.error("stdout:\n-------\n{}".format(e.stdout))
|
| |
_log.error("stderr:\n-------\n{}".format(e.stderr))
|
| |