diff --git a/scripts/confluence_create_or_update_report_page.py b/scripts/confluence_create_or_update_report_page.py index 595ad2f31df797e285ea410bffce2657521e258d..11b314c0e552ce182e3cb29bfcffff26191e7cf0 100755 --- a/scripts/confluence_create_or_update_report_page.py +++ b/scripts/confluence_create_or_update_report_page.py @@ -53,6 +53,8 @@ def convert_urls_to_links(text): url_pattern = r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+' text_with_links = re.sub(url_pattern, lambda x: f'<a href="{x.group(0)}">{x.group(0).split("/")[-1]}</a>', text) return text_with_links + +# Convert LAVA report in from CSV format to XHTML def convert_csv_report_to_xhtml(input_file, page_name, lava_url, lava_token, pipeline_url, testing_page_url, manifest_url, commit, branch, link_report, output_file): # Read CSV data and convert it into a list of dictionaries csv_file = input_file @@ -82,8 +84,15 @@ def convert_csv_report_to_xhtml(input_file, page_name, lava_url, lava_token, pip # Create XML structure for the initial SW info table info_root = ET.Element('root') - # Add headings to the info table - job_id = xml_data[0]['job'] + # Get job_id if available, or exit (e.g. incomplete LAVA job) + try: + job_id = xml_data[0]['job'] + except IndexError: + # Handle the case where xml_data list is empty + print("Error: No interesting job data found in the CSV file. A retrigger of the corresponding LAVA job may be necessary.") + exit(1) + + # Add heading to the page heading = ET.SubElement(info_root, 'h2') heading.text = f'Automatic LAVA Job: {job_id}' software_info_title = ET.SubElement(info_root, 'h3') @@ -109,7 +118,6 @@ def convert_csv_report_to_xhtml(input_file, page_name, lava_url, lava_token, pip # Distro name processing parts = page_name.split('-') - print(parts) if "things" in parts: distro = "Things" elif "embedded" in parts: @@ -358,7 +366,6 @@ def main(): # Strip distro related info from page name parts = args.page_name.split('-') - print(parts) if "things" in parts[-1]: distro = parts[-1:] index = (args.page_name).find("-things") diff --git a/scripts/get_jira_open_issues.py b/scripts/get_jira_open_issues.py old mode 100644 new mode 100755