diff --git a/notifier/.s2i/bin/assemble b/notifier/.s2i/bin/assemble
new file mode 100755
index 000000000..4e989c84b
--- /dev/null
+++ b/notifier/.s2i/bin/assemble
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+npm install -g npm@8.19.3
+npm install -g mjml@4.13.0
+
+exec /usr/libexec/s2i/assemble
\ No newline at end of file
diff --git a/notifier/Dockerfile b/notifier/Dockerfile
index 024122ed2..c278f8e93 100644
--- a/notifier/Dockerfile
+++ b/notifier/Dockerfile
@@ -9,10 +9,11 @@ RUN dnf install -y @ruby && \
rm -rf /tmp/src/.git* && \
chown -R 1001 /tmp/src && \
chgrp -R 0 /tmp/src && \
- chmod -R g+w /tmp/src
+ chmod -R g+w /tmp/src \
+ cp -rp /tmp/src/.s2i/bin /tmp/scripts
USER 1001
-RUN /usr/libexec/s2i/assemble
+RUN /tmp/scripts/assemble
CMD ["/usr/libexec/s2i/run"]
diff --git a/notifier/devfile.yaml b/notifier/devfile.yaml
index bb4d6eabf..87892f25c 100644
--- a/notifier/devfile.yaml
+++ b/notifier/devfile.yaml
@@ -1,6 +1,7 @@
commands:
- exec:
- commandLine: /usr/libexec/s2i/assemble
+ commandLine: >-
+ rm -rf /tmp/src && cp /tmp/projects -r /tmp/src && /tmp/src/.s2i/bin/assemble
component: s2i-builder
group:
isDefault: true
diff --git a/notifier/operator/operator.py b/notifier/operator/operator.py
index 184f8406e..ac311b69f 100755
--- a/notifier/operator/operator.py
+++ b/notifier/operator/operator.py
@@ -718,6 +718,7 @@ def send_notification_email(
)
)
template_vars['have_attachments'] = len(attachments) > 0
+ template_vars['service_status'] = ' '.join(elem.capitalize() for elem in template.replace('-', ' ').split())
email_subject = j2env.from_string(subject).render(**template_vars)
@@ -726,9 +727,16 @@ def send_notification_email(
else:
message_template = catalog_item.get_message_template(kebabToCamelCase(template))
if message_template:
- email_body = j2env.from_string(message_template).render(**template_vars)
+ mjml_template = j2env.from_string(message_template).render(**template_vars)
else:
- email_body = j2env.get_template(template + '.html.j2').render(**template_vars)
+ mjml_template = j2env.get_template(template + '.mjml.j2').render(**template_vars)
+
+ # Call for the MJML CLI to generate final HTML
+ email_body = subprocess.run(
+ ['mjml', '-i'],
+ stdout=subprocess.PIPE,
+ input=mjml_template,
+ encoding='ascii').stdout
msg = MIMEMultipart('alternative')
msg['Subject'] = email_subject
diff --git a/notifier/operator/templates/base.mjml.j2 b/notifier/operator/templates/base.mjml.j2
new file mode 100644
index 000000000..f4c84ddec
--- /dev/null
+++ b/notifier/operator/templates/base.mjml.j2
@@ -0,0 +1,54 @@
+
Your {{ catalog_namespace.display_name }} service, {{ service_display_name }}, has failed to provision. -{% if have_attachments %} -Please see attached Ansible log. -{% endif %} -
- -{% if service_url %} -You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Your {{ catalog_namespace.display_name }} service, {{ service_display_name }}, has failed to provision. + {% if have_attachments %} + Please see attached Ansible log. + {% endif %} +
+ + {% if service_url %} +You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Thank you for ordering {{ catalog_item.display_name }}.
- -Provisioning has started on your {{ catalog_namespace.display_name }} service, {{ service_display_name }}.
- -You will receive more information via email when the provisioning completes in about {{ provision_time_estimate }}. - -{% if service_url %} -
You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Thank you for ordering {{ catalog_item.display_name }}. Provisioning has started on + your {{ catalog_namespace.display_name }} service, {{ service_display_name }}.
+ +You will receive more information via email when the provisioning completes in about {{ provision_time_estimate }}.
+ + {% if service_url %} +You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Reminder:
-Your environment will expire and be deleted in {{ retirement_timedelta_humanized }} at {{ retirement_timestamp }}.
You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Reminder:
+ Your environment will expire and be deleted in {{ retirement_timedelta_humanized }} at {{ retirement_timestamp }}.
You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} has been deleted.
- -To conserve resources data on these systems is not archived and cannot be retrieved. -We apologize for any inconvenience this may cause. -Thank you for using {{ catalog_namespace.display_name }}.
- -{% if survey_link %} -We would love your feedback on your demo/lab, please fill out our short Survey (click here) to help us improve your experience.
-{% endif %} diff --git a/notifier/operator/templates/service-deleted.mjml.j2 b/notifier/operator/templates/service-deleted.mjml.j2 new file mode 100644 index 000000000..fe4ed5e4c --- /dev/null +++ b/notifier/operator/templates/service-deleted.mjml.j2 @@ -0,0 +1,21 @@ +{% extends "base.mjml.j2" %} +{% block content %} + +Your {{ catalog_namespace.display_name }} service {{ service_display_name }} has been deleted.
+ +To conserve resources data on these systems is not archived and cannot be retrieved. + We apologize for any inconvenience this may cause.
+ +Thank you for using {{ catalog_namespace.display_name }}.
+ + {% if survey_link %} +We would love your feedback on your demo/lab, please fill out our short Survey (click here) to help us improve your experience.
+ {% endif %} + +Thank you for ordering {{ catalog_item.display_name }}.
- -Your {{ catalog_namespace.display_name }} service {{ service_display_name }} is ready.
- -Please refer to the instructions for next steps and how to access your environment.
- -Troubleshooting and Access issues:
- -Always refer to the instructions to understand how to properly access and navigate your environment.
- -NOTICE:
-Your environment will be stopped in {{ stop_timedelta_humanized }} at {{ stop_timestamp }}.
-Your environment will expire and be deleted in {{ retirement_timedelta_humanized }} at {{ retirement_timestamp }}.
In order to conserve resources, we cannot archive or restore any data in this environment. -All data will be lost upon expiration.
- -{% if provision_messages is defined or provision_data is defined %} -Here is some important information about your environment:
- -{% if provision_messages_html is defined %} -{{ provision_messages_html }} -{% endif %} - -{% if provision_data is defined %} -{{ k | escape }}
{{ v | escape }}
{{ v | to_yaml | escape }}
You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Thank you for ordering {{ catalog_item.display_name }}.
+ +Your {{ catalog_namespace.display_name }} service {{ service_display_name }} is ready.
+ +Always refer to the instructions to understand how to properly access and navigate your environment.
+ +
+ NOTICE:
+
You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
{{ v | to_yaml | escape }}
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} has started.
- -NOTICE:
-Your environment will be stopped in {{ stop_timedelta_humanized }} at {{ stop_timestamp }}.
-Your environment will expire and be deleted in {{ retirement_timedelta_humanized }} at {{ retirement_timestamp }}.
You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} has started.
+ +
+ NOTICE:
+
You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} failed to start. -{% if have_attachments %} -Please see attached Ansible log. -{% endif %} -
- -{% if service_url %} -You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} failed to start. + {% if have_attachments %} + Please see attached Ansible log. + {% endif %} +
+ + {% if service_url %} +You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} has stopped.
- -{% if service_url %} -You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} has stopped.
+ + {% if service_url %} +You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} failed to stop. -{% if have_attachments %} -Please see attached Ansible log. -{% endif %} -
- -{% if service_url %} -You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Your {{ catalog_namespace.display_name }} service {{ service_display_name }} failed to stop. + {% if have_attachments %} + Please see attached Ansible log. + {% endif %} +
+ + {% if service_url %} +You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.
Reminder:
-Your environment will be stopped in {{ stop_timedelta_humanized }} at {{ stop_timestamp }}.
You may manage your {{ catalog_namespace.display_name }} service at:
-{{ service_url }}.
Reminder:
+ Your environment will be stopped in {{ stop_timedelta_humanized }} at {{ stop_timestamp }}.
You may manage your {{ catalog_namespace.display_name }} service at:
+ {{ service_url }}.