diff --git a/.drone.jsonnet b/.drone.jsonnet
index 786565e..cbde015 100644
--- a/.drone.jsonnet
+++ b/.drone.jsonnet
@@ -155,9 +155,39 @@ local PipelineBuild = {
},
};
+local PipelineNotifications = {
+ kind: "pipeline",
+ name: "notifications",
+ platform: {
+ os: "linux",
+ arch: "amd64",
+ },
+ steps: [
+ {
+ name: "matrix",
+ image: "plugins/matrix",
+ settings: {
+ template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}",
+ roomid: { "from_secret": "matrix_roomid" },
+ homeserver: { "from_secret": "matrix_homeserver" },
+ username: { "from_secret": "matrix_username" },
+ password: { "from_secret": "matrix_password" },
+ },
+ },
+ ],
+ depends_on: [
+ "build",
+ ],
+ trigger: {
+ ref: ["refs/heads/master", "refs/tags/**"],
+ status: [ "success", "failure" ],
+ },
+};
+
[
PipelineLint,
PipelineTest,
PipelineSecurity,
PipelineBuild,
+ PipelineNotifications,
]
diff --git a/.drone.yml b/.drone.yml
index 49e1aed..68dc711 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -177,8 +177,41 @@ trigger:
depends_on:
- security
+---
+kind: pipeline
+name: notifications
+
+platform:
+ os: linux
+ arch: amd64
+
+steps:
+- name: matrix
+ image: plugins/matrix
+ settings:
+ homeserver:
+ from_secret: matrix_homeserver
+ password:
+ from_secret: matrix_password
+ roomid:
+ from_secret: matrix_roomid
+ template: "Status: **{{ build.status }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
Message: {{ build.message }}"
+ username:
+ from_secret: matrix_username
+
+trigger:
+ ref:
+ - refs/heads/master
+ - "refs/tags/**"
+ status:
+ - success
+ - failure
+
+depends_on:
+- build
+
---
kind: signature
-hmac: 7b7b9ad0e0945e50acc6c70bd430574f6ab8df62013692e12cbdcf5018baafe9
+hmac: 602f1e2058d0b5d15da827d7893c2f111bb161741bfd7ea60cc2b882e1a54ea2
...
diff --git a/ansibledoctor/Utils.py b/ansibledoctor/Utils.py
index 531fed6..2e4c32b 100644
--- a/ansibledoctor/Utils.py
+++ b/ansibledoctor/Utils.py
@@ -17,6 +17,10 @@ CONSOLE_FORMAT = "{}[%(levelname)s]{} %(message)s"
JSON_FORMAT = "(asctime) (levelname) (message)"
+def to_bool(string):
+ return bool(strtobool(str(string)))
+
+
def _should_do_markup():
py_colors = os.environ.get("PY_COLORS", None)
if py_colors is not None:
@@ -215,7 +219,3 @@ class FileUtils:
to_bool(choice)
except (KeyboardInterrupt, ValueError) as e:
raise ansibledoctor.Exception.InputError("Error while reading input", e)
-
-
-def to_bool(string):
- return bool(strtobool(str(string)))