Merge changes Iac352bac,I88f46391
* changes:
Fix tag rackoon version from job info
Hide logs if all of JENKINS_USER, JENKINS_PASSWORD var is not set
diff --git a/rp_reporter/rp_reporter/batch_reporter.py b/rp_reporter/rp_reporter/batch_reporter.py
index 1a92ddc..315e04d 100755
--- a/rp_reporter/rp_reporter/batch_reporter.py
+++ b/rp_reporter/rp_reporter/batch_reporter.py
@@ -20,6 +20,8 @@
from rp_reporter.settings import TIME_FORMAT
from rp_reporter.report_from_xml import timestamp, Reporter
+from rp_reporter.settings import JENKINS_USER, JENKINS_PASSWORD
+
LOG = logging.getLogger("rp_reporter")
@@ -81,7 +83,7 @@
return f"[#{self.job_number} {self.job_status}]({self.job_url}) "
def add_test_result(
- self, test_name:str=None, testrail_url:str=None, rp_url:str=None, statistics:str=None
+ self, test_name: str = None, testrail_url: str = None, rp_url: str = None, statistics: str = None
):
testrail_msg = f"[TestRailURL]({testrail_url})" if testrail_url else ""
self.rp_url = rp_url
@@ -137,14 +139,14 @@
tags["dvr"] = False
if vpnaas := jmespath.search(
- "items[*].spec.features.neutron.extensions.vpnaas.enabled", osdpl_dict
+ "items[*].spec.features.neutron.extensions.vpnaas.enabled", osdpl_dict
):
tags["vpnaas"] = vpnaas[0]
else:
tags["vpnaas"] = False
if nova_images := jmespath.search(
- "items[*].spec.features.nova.images.backend", osdpl_dict
+ "items[*].spec.features.nova.images.backend", osdpl_dict
):
tags["nova.images.backend"] = nova_images[0]
@@ -152,7 +154,7 @@
def get_image_from_describe(
- job_obj, describe_file_pattern, image_pattern, from_artifactory=False
+ job_obj, describe_file_pattern, image_pattern, from_artifactory=False
):
if from_artifactory:
local_describe_file = job_obj.get_artifacts(describe_file_pattern)
@@ -220,7 +222,7 @@
all_logs = job.get_logs()
for log in grep(
- text=all_logs, patterns=catch_logs, context_size=8, blacklist=blacklist
+ text=all_logs, patterns=catch_logs, context_size=8, blacklist=blacklist
):
# LOG.error("Attach logs {}".format("\n".join(log)))
rp_client.log(time=timestamp(), message="\n".join(log), item_id=subjob_item_id)
@@ -319,7 +321,7 @@
run_tags.update(get_tags_from_osdpl(osdpl_file))
rp_client.update_test_item(attributes=run_tags,
item_uuid=launch_id)
- description.rockoon_version = tags.get("rockoon_version")
+ description.rockoon_version = run_tags.get("rockoon_version")
case "tempest-runner-k8s":
title = "Tempest"
@@ -388,7 +390,7 @@
f"Can't found 'test_check_downtime_statistic_result.xml' in {child.url}"
)
test_results_files = [f"{artifactory_url}/artifacts/"
- f"test_check_downtime_statistic_result.xml"]
+ f"test_check_downtime_statistic_result.xml"]
case "collect-openstack-kaas-artifacts":
artifactory_url = child.description.split("url: ")[-1]
@@ -455,17 +457,18 @@
end_time=timestamp(),
attributes=run_tags,
description=str(description)
- + f"\nPod Logs {artifactory_url}/pod-logs.tar.gz",
+ + f"\nPod Logs {artifactory_url}/pod-logs.tar.gz",
)
print(f"report is here {report_url}")
- print("Pushing new description to job...")
- try:
- job.description = (
- job.description + f"<br><br> "
- f"<a href='{report_url}'>Link to ReportPortal</a> <br>"
- )
- except Exception as e:
- print(f"Can't push description to {job=}: {e}")
+ if JENKINS_USER or JENKINS_PASSWORD:
+ print("Pushing new description to job...")
+ try:
+ job.description = (
+ job.description + f"<br><br> "
+ f"<a href='{report_url}'>Link to ReportPortal</a> <br>"
+ )
+ except Exception as e:
+ print(f"Can't push description to {job=}: {e}")
print(f" ʕノ•ᴥ•ʔノ Completed")
diff --git a/rp_reporter/rp_reporter/settings.py b/rp_reporter/rp_reporter/settings.py
index 74420bc..9a3ef56 100644
--- a/rp_reporter/rp_reporter/settings.py
+++ b/rp_reporter/rp_reporter/settings.py
@@ -50,6 +50,13 @@
environ.get("RP_PROJECT") or from_conf("RP_PROJECT") or call_error("RP_PROJECT")
)
+JENKINS_USER = (
+ environ.get('JENKINS_USER') or from_conf("JENKINS_USER")
+)
+JENKINS_PASSWORD = (
+ environ.get('JENKINS_PASSWORD') or from_conf("JENKINS_PASSWORD")
+)
+
TIME_FORMAT = "%Y-%m-%d"
if __name__ == "__main__":