Skip to content
Snippets Groups Projects
Commit 4edd5a75 authored by Charlotte Hausman's avatar Charlotte Hausman
Browse files

Merge branch 'catch_up_with_main_2.8.2' into '2.8.2-DEVELOPMENT'

catch up with 2.8.1.1, pin zope.sqlalchemy to 2.0

See merge request !1408
parents 677367ce 1d166971
No related branches found
No related tags found
2 merge requests!1452Merge 2.8.2 to main,!1408catch up with 2.8.1.1, pin zope.sqlalchemy to 2.0
Pipeline #10572 passed
Showing
with 548 additions and 443 deletions
# This file is automatically @generated by Poetry 1.5.0 and should not be changed by hand.
# This file is automatically @generated by Poetry 1.5.1 and should not be changed by hand.
[[package]]
name = "colorama"
......@@ -13,23 +13,23 @@ files = [
[[package]]
name = "dsnparse"
version = "0.2.0"
version = "0.1.15"
description = "parse dsn urls"
optional = false
python-versions = "*"
files = [
{file = "dsnparse-0.2.0.tar.gz", hash = "sha256:86334148ccdbb52911c8828edb6a5f3064cd52b3a7fd4072c391fa3fa7a87031"},
{file = "dsnparse-0.1.15.tar.gz", hash = "sha256:2ac5705b17cb28e8b115053c2d51cf3321dc2041b1d75e2db6157e05146d0fba"},
]
[[package]]
name = "exceptiongroup"
version = "1.1.1"
version = "1.1.2"
description = "Backport of PEP 654 (exception groups)"
optional = false
python-versions = ">=3.7"
files = [
{file = "exceptiongroup-1.1.1-py3-none-any.whl", hash = "sha256:232c37c63e4f682982c8b6459f33a8981039e5fb8756b2074364e5055c498c9e"},
{file = "exceptiongroup-1.1.1.tar.gz", hash = "sha256:d484c3090ba2889ae2928419117447a14daf3c1231d5e30d0aae34f354f01785"},
{file = "exceptiongroup-1.1.2-py3-none-any.whl", hash = "sha256:e346e69d186172ca7cf029c8c1d16235aa0e04035e5750b4b95039e65204328f"},
{file = "exceptiongroup-1.1.2.tar.gz", hash = "sha256:12c3e887d6485d16943a309616de20ae5582633e0a2eda17f4e10fd61c1e8af5"},
]
[package.extras]
......@@ -123,13 +123,13 @@ files = [
[[package]]
name = "pymysql"
version = "1.0.3"
version = "1.1.0"
description = "Pure Python MySQL Driver"
optional = false
python-versions = ">=3.7"
files = [
{file = "PyMySQL-1.0.3-py3-none-any.whl", hash = "sha256:89fc6ae41c0aeb6e1f7710cdd623702ea2c54d040565767a78b00a5ebb12f4e5"},
{file = "PyMySQL-1.0.3.tar.gz", hash = "sha256:3dda943ef3694068a75d69d071755dbecacee1adf9a1fc5b206830d2b67d25e8"},
{file = "PyMySQL-1.1.0-py3-none-any.whl", hash = "sha256:8969ec6d763c856f7073c4c64662882675702efcb114b4bcbb955aea3a069fa7"},
{file = "PyMySQL-1.1.0.tar.gz", hash = "sha256:4f13a7df8bf36a51e81dd9f3605fede45a4878fe02f9236349fd82a3f0612f96"},
]
[package.extras]
......@@ -138,13 +138,13 @@ rsa = ["cryptography"]
[[package]]
name = "pytest"
version = "7.3.2"
version = "7.4.0"
description = "pytest: simple powerful testing with Python"
optional = false
python-versions = ">=3.7"
files = [
{file = "pytest-7.3.2-py3-none-any.whl", hash = "sha256:cdcbd012c9312258922f8cd3f1b62a6580fdced17db6014896053d47cddf9295"},
{file = "pytest-7.3.2.tar.gz", hash = "sha256:ee990a3cc55ba808b80795a79944756f315c67c12b56abd3ac993a7b8c17030b"},
{file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"},
{file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"},
]
[package.dependencies]
......@@ -172,4 +172,4 @@ files = [
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "f7e6f600b14601bba133b5fe13b9ba6fe974fc839d1aad575c3d822c66d4b543"
content-hash = "29ad67bf80199bd5e4369f74fe04c8fad378439f046f18af9ea0caebf608f298"
......@@ -8,7 +8,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
dsnparse = "^0.2.0"
dsnparse = "0.1.15"
mysqlclient = "2.1.1"
psycopg2 = "^2.9.6"
pycapo = "^0.3.1"
......
......@@ -127,9 +127,9 @@ def main(argv):
- apps/cli/executables/go/**/*"""
else:
if deploy_env == "test":
rule = "$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/"
rule = "$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0.9]+-rc[0-9]+/"
if deploy_env == "prod":
rule = "$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/"
rule = "$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/"
write_global_rule(rule=rule)
go_changes = get_list_of_go_modules()
......
......@@ -32,7 +32,7 @@
DEPLOY_ENV: "test"
changes:
- ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0.9]+-rc[0-9]+/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
VERSION: $CI_COMMIT_TAG
......@@ -40,7 +40,7 @@
DEPLOY_ENV: "test"
changes:
- ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
VERSION: $CI_COMMIT_TAG
......
......@@ -10,18 +10,18 @@
IMAGE_TAG: $CI_COMMIT_BRANCH
changes:
- ${PATH_PREFIX}${SERVICE_NAME}/**/*
# For pipeline testing only!
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# variables:
# IMAGE_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
# changes:
# - ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'
# For pipeline testing only!
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# variables:
# IMAGE_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
# changes:
# - ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0.9]+-rc[0-9]+/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
changes:
- ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
changes:
......
......@@ -20,12 +20,12 @@
IMAGE_TAG: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
changes:
- ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/'
- if: '$CI_COMMIT_TAG =~ /^end-of-sprint-[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]+/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0.9]+-rc[0-9]+/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
changes:
- ${PATH_PREFIX}${SERVICE_NAME}/**/*
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/'
- if: '$CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+$/ || $CI_COMMIT_TAG =~ /[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/'
variables:
IMAGE_TAG: $CI_COMMIT_TAG
changes:
......
......@@ -43,5 +43,5 @@ tqdm
transaction
waitress
zc.buildout
zope.sqlalchemy
zope.sqlalchemy==2.0
immutable_views
This diff is collapsed.
......@@ -22,7 +22,7 @@ pyOpenSSL = "^23.1.1"
requests = "^2.28.2"
sqlalchemy = "1.4.47"
waitress = "^2.1.2"
"zope.sqlalchemy" = "^2.0"
"zope.sqlalchemy" = "2.0"
immutable-views = "^0.6.1"
sentry-sdk = "1.5.10"
prometheus-client = "0.4.1"
......
This diff is collapsed.
......@@ -17,7 +17,7 @@ pyopenssl = "^23.1.1"
requests = "^2.29.0"
waitress = "^2.1.2"
sqlalchemy = "1.4.47"
zope-sqlalchemy = "^2.0"
"zope.sqlalchemy" = "2.0"
workspaces = {path = "../../shared/workspaces"}
psycopg2 = "^2.9.6"
......
This diff is collapsed.
......@@ -18,7 +18,7 @@ sqlalchemy = "1.4.47"
waitress = "^2.1.2"
workspaces = {path = "../../shared/workspaces"}
messaging = {path = "../../shared/messaging"}
zope-sqlalchemy = "^2.0"
"zope.sqlalchemy" = "2.0"
immutable-views = "^0.6.1"
sentry-sdk = "1.5.0"
prometheus-client = "0.4.1"
......
This diff is collapsed.
......@@ -17,6 +17,7 @@ requests = "^2.29.0"
transaction = "^3.1.0"
immutable-views = "^0.6.1"
pendulum = "^2.1.2"
email-validator = "2.0.0"
[tool.poetry.group.test.dependencies]
......
......@@ -26,6 +26,7 @@ import smtplib
from typing import Dict
import requests
from email_validator import validate_email, EmailNotValidError
from pycapo import CapoConfig
from workspaces.notification.services.interfaces import (
......@@ -70,38 +71,50 @@ class NotificationService(NotificationServiceIF):
if isinstance(parameters["destination_email"], list):
receiver_emails = parameters["destination_email"]
else:
receiver_emails = [parameters["destination_email"]]
# sometimes the list gets passed in as a string, split it if needed and strip extra spaces
receiver_emails = [address.strip() for address in parameters["destination_email"].split(",")]
# Let's not send emails into the void
if not receiver_emails:
return "No PI email found."
logger.info(f">> In send_email, sending email to: {receiver_emails}")
logger.info(f">> The parameters are: {parameters}")
template = self.info.lookup_template(template_name)
# verify email addresses are valid. Drop invalid addresses
for address in receiver_emails:
try:
validate_email(address)
except EmailNotValidError as e:
logger.info(f"Invalid email address {address} found, removing from receivers list.")
receiver_emails.remove(address)
if template is None:
logger.info("No template '" + template_name + "' found.")
if len(receiver_emails) > 0:
logger.info(f">> In send_email, sending email to: {receiver_emails}")
logger.info(f">> The parameters are: {parameters}")
template = self.info.lookup_template(template_name)
file = template.render(parameters)
if template is None:
logger.info("No template '" + template_name + "' found.")
# Load the headers and email content from the template
msg = email.message_from_bytes(file.content)
file = template.render(parameters)
# Attach the 'from', 'to', and 'cc' headers if they weren't set in the template
if msg["From"] is None:
msg["From"] = sender_email
# Load the headers and email content from the template
msg = email.message_from_bytes(file.content)
if msg["To"] is None:
msg["To"] = ', '.join(receiver_emails)
# Attach the 'from', 'to', and 'cc' headers if they weren't set in the template
if msg["From"] is None:
msg["From"] = sender_email
if msg["Cc"] is None and "cc_email" in parameters and parameters["cc_email"] is not None:
if isinstance(parameters["cc_email"], list):
msg["Cc"] = ', '.join(parameters["cc_email"])
else:
msg["Cc"] = parameters["cc_email"]
if msg["To"] is None:
msg["To"] = ", ".join(receiver_emails)
with smtplib.SMTP(smtp_server) as server:
r = server.send_message(msg)
if msg["Cc"] is None and "cc_email" in parameters and parameters["cc_email"] is not None:
if isinstance(parameters["cc_email"], list):
msg["Cc"] = ", ".join(parameters["cc_email"])
else:
msg["Cc"] = parameters["cc_email"]
return r
with smtplib.SMTP(smtp_server) as server:
r = server.send_message(msg)
return r
else:
logger.info("No valid email addresses provided. Skipping sending mail.")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment