From c774acbb980a0cd125a9fbe79c417487b60f8639 Mon Sep 17 00:00:00 2001 From: Oliver Giles Date: Sat, 26 Sep 2020 08:53:17 +1200 Subject: [PATCH] add example email notification scripts --- UserManual.md | 2 + .../format-test-results | 0 .../junit-bs-style.xsl | 0 examples/notify-email-pretty.sh | 55 +++++++++++++++++++ examples/notify-email-text-log.sh | 18 ++++++ 5 files changed, 75 insertions(+) rename {example-scripts => examples}/format-test-results (100%) rename {example-scripts => examples}/junit-bs-style.xsl (100%) create mode 100755 examples/notify-email-pretty.sh create mode 100755 examples/notify-email-text-log.sh diff --git a/UserManual.md b/UserManual.md index b8be94f..6708d19 100644 --- a/UserManual.md +++ b/UserManual.md @@ -373,6 +373,8 @@ author_email=$(git show -s --format='%ae' $rev) laminarc set RECIPIENTS $author_email ``` +See [notify-email-pretty.sh](https://github.com/ohwgiles/laminar/blob/master/examples/notify-email-pretty.sh) and [notify-email-text-log.sh](https://github.com/ohwgiles/laminar/blob/master/examples/notify-email-text-log.sh). + --- # Helper scripts diff --git a/example-scripts/format-test-results b/examples/format-test-results similarity index 100% rename from example-scripts/format-test-results rename to examples/format-test-results diff --git a/example-scripts/junit-bs-style.xsl b/examples/junit-bs-style.xsl similarity index 100% rename from example-scripts/junit-bs-style.xsl rename to examples/junit-bs-style.xsl diff --git a/examples/notify-email-pretty.sh b/examples/notify-email-pretty.sh new file mode 100755 index 0000000..b15c610 --- /dev/null +++ b/examples/notify-email-pretty.sh @@ -0,0 +1,55 @@ +#!/bin/bash -e + +# IMPORTANT: change these to appropriate values, or fetch them, for example +# from the environment or from $(git show -s --format='%ae' $rev) +TO_EMAIL=engineering@example.com +FROM_EMAIL=laminar@example.com + +LAMINAR_URL=${LAMINAR_BASE_URL:-http://localhost:8080} +LAMINAR_TITLE=${LAMINAR_TITLE:-Laminar CI} + +if [[ $RESULT = "success" ]]; then + SVGICON=$(cat <<-EOF + + + + EOF + ) +else + SVGICON=$(cat <<-EOF + + + + EOF + ) +fi + +sendmail -t < + + + +
+ + + + + + +
$LAMINAR_TITLE
+ $SVGICON + $JOB #$RUN +
+
+ + +EOF diff --git a/examples/notify-email-text-log.sh b/examples/notify-email-text-log.sh new file mode 100755 index 0000000..f257109 --- /dev/null +++ b/examples/notify-email-text-log.sh @@ -0,0 +1,18 @@ +#!/bin/bash -e + +# IMPORTANT: change these to appropriate values, or fetch them, for example +# from the environment or from $(git show -s --format='%ae' $rev) +TO_EMAIL=engineering@example.com +FROM_EMAIL=laminar@example.com + +LAMINAR_URL=${LAMINAR_BASE_URL:-http://localhost:8080} + +sendmail -t <