From 8a76816452332f5f8ce05f86a141622108549cc6 Mon Sep 17 00:00:00 2001 From: Ralf Roeber Date: Fri, 24 May 2024 14:47:31 +0000 Subject: [PATCH 1/6] client03.yaml update on install path --- gitlab-ci-yamls/client03.prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gitlab-ci-yamls/client03.prod.yml b/gitlab-ci-yamls/client03.prod.yml index a0371150..872fe0ef 100644 --- a/gitlab-ci-yamls/client03.prod.yml +++ b/gitlab-ci-yamls/client03.prod.yml @@ -7,7 +7,7 @@ ######################################################### # BACKEND ######################################################### - DEPLOY_BACKEND_FOLDER: "/opt/cometa" + DEPLOY_BACKEND_FOLDER: "/opt/IBM/cometa" COMETA_DOMAIN: "$CLIENT_03_DOMAIN" COMETA_DEBUG: "False" COMETA_EMAIL_HOST: '$COMETA_CLIENT01_EMAIL_HOST' From 859455fd898a1ddf89020e891d193cfd44365839 Mon Sep 17 00:00:00 2001 From: Ralf Roeber Date: Mon, 27 May 2024 07:20:58 +0000 Subject: [PATCH 2/6] Fixing Port issues for client03.yml by removing 443 + 4200 from docker-compose (#4618) --- backend/.gitignore | 0 backend/README.md | 0 backend/docker-compose-tests.yml | 0 docker-compose-dev.yml | 0 gitlab-ci-yamls/client03.prod.yml | 2 ++ 5 files changed, 2 insertions(+) mode change 100755 => 100644 backend/.gitignore mode change 100755 => 100644 backend/README.md mode change 100755 => 100644 backend/docker-compose-tests.yml mode change 100755 => 100644 docker-compose-dev.yml diff --git a/backend/.gitignore b/backend/.gitignore old mode 100755 new mode 100644 diff --git a/backend/README.md b/backend/README.md old mode 100755 new mode 100644 diff --git a/backend/docker-compose-tests.yml b/backend/docker-compose-tests.yml old mode 100755 new mode 100644 diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml old mode 100755 new mode 100644 diff --git a/gitlab-ci-yamls/client03.prod.yml b/gitlab-ci-yamls/client03.prod.yml index 872fe0ef..68b3435c 100644 --- a/gitlab-ci-yamls/client03.prod.yml +++ b/gitlab-ci-yamls/client03.prod.yml @@ -24,6 +24,8 @@ ######################################################### # FRONTEND ######################################################### + # Remove standard ports for this client, as it conflicts with other running software + - sed -i '/443:443/d; /4200:4200/d' docker-compose.yml # make infra folder - docker exec cometa_front bash -c "mkdir -p /usr/local/apache2/htdocs/infra" # make a lbtest1.html file with some status info From f7bad35d2b6f7b7f91f66df15a1e57d902acd19b Mon Sep 17 00:00:00 2001 From: "anand.kushwaha" Date: Mon, 27 May 2024 13:10:47 +0530 Subject: [PATCH 3/6] #4707 Corrected email variables and Screenshot sequence --- backend/src/backend/generatePDF.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/src/backend/generatePDF.py b/backend/src/backend/generatePDF.py index a4773e75..0d9772a6 100644 --- a/backend/src/backend/generatePDF.py +++ b/backend/src/backend/generatePDF.py @@ -415,7 +415,10 @@ def BuildEmailSubject(self): def process_custom_body_for_screenshots(self,email_multi_alternatives) -> dict: logger.debug("Processing custom body") # get all the steps in the feature results - step_results_screenshots = Step_result.objects.values_list('screenshot_current').filter(feature_result_id=self.feature_result_id).order_by("step_result_id") + step_results_screenshots = Step_result.objects.values_list('screenshot_current') \ + .filter(feature_result_id=self.feature_result_id) \ + .exclude(screenshot_current__exact='') \ + .order_by("step_result_id") # Define the regex pattern pattern = r'\$screenshot\[(\d+)\]' @@ -452,6 +455,9 @@ def process_custom_body_for_screenshots(self,email_multi_alternatives) -> dict: invalid_screenshot_names.append(screenshot_name) if invalid_screenshot_names: new_email_body += f"Invalid Screenshot names: {','.join(invalid_screenshot_names)}" + + new_email_body = self.replaceFeatureVariables(new_email_body) + return new_email_body, email_multi_alternatives def BuildEmailBody(self): From 8cb319f0b6656a8f7898f129dfae2de125ec98fe Mon Sep 17 00:00:00 2001 From: "anand.kushwaha" Date: Mon, 27 May 2024 18:47:54 +0530 Subject: [PATCH 4/6] #4707 Fixed change image format to PNG while sending email --- backend/src/backend/generatePDF.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/backend/src/backend/generatePDF.py b/backend/src/backend/generatePDF.py index 0d9772a6..0c107f2f 100644 --- a/backend/src/backend/generatePDF.py +++ b/backend/src/backend/generatePDF.py @@ -32,6 +32,8 @@ import logging.handlers import datetime from email.mime.image import MIMEImage +from PIL import Image + # logger information logger = getLogger() @@ -435,21 +437,33 @@ def process_custom_body_for_screenshots(self,email_multi_alternatives) -> dict: # logger.debug("Found match ") # logger.debug(f"Match: {match.group(0)}, Number: {match.group(1)}, Start: {match.start()}, End: {match.end()}") # This is to check if number of screenshot available in the step report are less or equal to screenshot index requested in the email - logger.debug(f'{screen_shot_index} {len(step_results_screenshots)}') + # logger.debug(f'{screen_shot_index} {len(step_results_screenshots)}') if screen_shot_index>0 and len(step_results_screenshots)>=screen_shot_index: # Create dictionary with $screenshot[n] = path/to/screenshot # logger.debug("Attaching screenshots") logger.debug(step_results_screenshots[screen_shot_index-1]) screen_shot = step_results_screenshots[screen_shot_index-1][0] # Add image tag to show image in with mail - new_email_body = new_email_body.replace(screenshot_name, f'') + image_path = os.path.join(settings.SCREENSHOTS_ROOT, screen_shot) + image_name = image_path.split("/") + logger.debug(image_name) + if len(image_name)>0: + image_name = image_name[-1].split(".")[-2] + + image_name+='.png' + logger.debug(image_name) + new_email_body = new_email_body.replace(screenshot_name, f'{image_name}') # logger.debug(name) # logger.debug(new_email_body) # logger.debug(f"Attaching Screenshot {screen_shot}") - image_path = os.path.join(settings.SCREENSHOTS_ROOT, screen_shot) - with open(image_path, 'rb') as img: - mime_image = MIMEImage(img.read(), _subtype="png") + with Image.open(image_path) as img: + with BytesIO() as output: + img.save(output, format='PNG') + png_data = output.getvalue() + mime_image = MIMEImage(png_data, _subtype="png") mime_image.add_header('Content-ID', f'<{screenshot_name}>') + mime_image.add_header('X-Attachment-Id', f'{screenshot_name}') + mime_image.add_header('Content-Disposition', 'inline', filename=image_name) email_multi_alternatives.attach(mime_image) else: invalid_screenshot_names.append(screenshot_name) From 46214d6588498a59c210d2d332803af7e38adbec Mon Sep 17 00:00:00 2001 From: "anand.kushwaha" Date: Mon, 27 May 2024 18:51:16 +0530 Subject: [PATCH 5/6] #4564 Added before_script in the client03.yml file --- gitlab-ci-yamls/client03.prod.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gitlab-ci-yamls/client03.prod.yml b/gitlab-ci-yamls/client03.prod.yml index 68b3435c..0db004fd 100644 --- a/gitlab-ci-yamls/client03.prod.yml +++ b/gitlab-ci-yamls/client03.prod.yml @@ -12,6 +12,8 @@ COMETA_DEBUG: "False" COMETA_EMAIL_HOST: '$COMETA_CLIENT01_EMAIL_HOST' COMETA_EMAIL_USER: '$COMETA_CLIENT01_EMAIL_USER' + COMETA_DJANGO_SECRETKEY: '$COMETA_CLIENT03_DJANGO_SECRETKEY' + COMETA_BEHAVE_SECRETKEY: '$COMETA_CLIENT03_BEHAVE_SECRETKEY' COMETA_PROXY_ENABLED: 'True' COMETA_PROXY: '$CLIENT_03_PROXY' COMETA_NO_PROXY: '$CLIENT_03_NO_PROXY' @@ -20,12 +22,21 @@ ######################################################### DOCKER_HTTP_PORT: 58080 DOCKER_OPENIDC_CONFIG_EXT: "client01_int" - after_script: + before_script: ######################################################### # FRONTEND ######################################################### # Remove standard ports for this client, as it conflicts with other running software - sed -i '/443:443/d; /4200:4200/d' docker-compose.yml + # Client uses port 58080, which is mapped to load balancer, make changes persistent for port 58080 + # - sed -i 's#/data/cometa/#./data/cometa/#g' docker-compose.yml + - sed -i_template "s#- /data#- \./data#g" docker-compose.yml + + after_script: + ######################################################### + # FRONTEND + ######################################################### + # make infra folder - docker exec cometa_front bash -c "mkdir -p /usr/local/apache2/htdocs/infra" # make a lbtest1.html file with some status info From ba0e8eba3ef495361971df1e27ec7d0b5b228af1 Mon Sep 17 00:00:00 2001 From: "anand.kushwaha" Date: Mon, 27 May 2024 18:57:31 +0530 Subject: [PATCH 6/6] #4707 Updated config.json --- front/src/assets/config.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/front/src/assets/config.json b/front/src/assets/config.json index 5e91e7ee..13a6c7b5 100755 --- a/front/src/assets/config.json +++ b/front/src/assets/config.json @@ -1,5 +1,5 @@ { - "version": "2.8.345", + "version": "2.8.346", "language": "en", "appTitle": "co.meta", "scenario": "dev", @@ -232,6 +232,16 @@ "{Code is Poetry}" ], "changelog": [ + { + "version": "2.8.346", + "date": "2024-05-27", + "features": [ + { + "title": "#4707 Changes made in the PDF to support outlook email client when sending image.", + "description": "Outlook was not showing sent image properly, fixed code to support outlook email client." + } + ] + }, { "version": "2.8.345", "date": "2024-05-24",