diff --git a/.drone.star b/.drone.star
index 4981fcffba1..29e10a1b8b5 100644
--- a/.drone.star
+++ b/.drone.star
@@ -35,7 +35,6 @@ PLUGINS_GIT_ACTION = "plugins/git-action:1"
PLUGINS_MANIFEST = "plugins/manifest:1"
PLUGINS_S3 = "plugins/s3:1"
PLUGINS_S3_CACHE = "plugins/s3-cache:1"
-PLUGINS_SLACK = "plugins/slack:1"
REDIS = "redis:6-alpine"
SONARSOURCE_SONAR_SCANNER_CLI = "sonarsource/sonar-scanner-cli:11.0"
@@ -332,11 +331,6 @@ config = {
"tikaNeeded": True,
},
},
- "rocketchat": {
- "channel": "builds",
- "channel_cron": "builds",
- "from_secret": "rocketchat_talk_webhook",
- },
"binaryReleases": {
"os": ["linux", "darwin"],
},
@@ -2351,28 +2345,25 @@ def makeGoGenerate(module):
def notify(ctx):
status = ["failure"]
- channel = config["rocketchat"]["channel"]
if ctx.build.event == "cron":
status.append("success")
- channel = config["rocketchat"]["channel_cron"]
return {
"kind": "pipeline",
"type": "docker",
"name": "chat-notifications",
- "clone": {
- "disable": True,
- },
"steps": [
{
- "name": "notify-rocketchat",
- "image": PLUGINS_SLACK,
- "settings": {
- "webhook": {
- "from_secret": config["rocketchat"]["from_secret"],
+ "name": "notify-matrix",
+ "image": OC_CI_ALPINE,
+ "environment": {
+ "MATRIX_TOKEN": {
+ "from_secret": "matrix_token",
},
- "channel": channel,
},
+ "commands": [
+ "bash %s/tests/config/drone/notification.sh" % (dirs["base"]),
+ ],
},
],
"depends_on": [],
diff --git a/tests/config/drone/notification.sh b/tests/config/drone/notification.sh
new file mode 100644
index 00000000000..909a9e57ee0
--- /dev/null
+++ b/tests/config/drone/notification.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+set -e
+
+COMMIT_SHA_SHORT=${DRONE_COMMIT:0:8}
+BUILD_STATUS="✅ Success"
+ROOMID="!rnWsCVUmDHDJbiSPMM:matrix.org"
+
+
+if [ ${DRONE_BUILD_STATUS} == "failure" ]; then
+ BUILD_STATUS="❌️ Failure"
+fi
+
+message_html=''$BUILD_STATUS' '${DRONE_REPO}'#'$COMMIT_SHA_SHORT' ('${DRONE_BRANCH}') by '${DRONE_COMMIT_AUTHOR}''
+message_html=$(echo "$message_html" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g')
+
+response=$(curl -s -o /dev/null -X PUT -w "%{http_code}" 'https://matrix.org/_matrix/client/v3/rooms/'$ROOMID'/send/m.room.message/'$(date +%s) \
+ -H "Authorization: Bearer "$MATRIX_TOKEN \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "msgtype": "m.text",
+ "body": "'"$message_html"'",
+ "format": "org.matrix.custom.html",
+ "formatted_body": "'"$message_html"'"
+ }')
+
+if [ $status_code != 200 ]; then
+ echo "❌ Error: failed sending notification to matrix"
+ exit 1
+fi