From a576e01b175bdeec4cda3102111207b9454ee52a Mon Sep 17 00:00:00 2001 From: Simon C Date: Mon, 9 Sep 2024 18:07:45 +0200 Subject: [PATCH] feat: ajout de la CI --- .drone.yml | 38 ++++++++++++++++++++++++++++++++++++++ index.js | 1 + 2 files changed, 39 insertions(+) create mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..64a2f4c --- /dev/null +++ b/.drone.yml @@ -0,0 +1,38 @@ +--- +# drone encrypt Weko/lestoitsduval-alerting $MJ_APIKEY_PUBLIC +kind: secret +name: MJ_APIKEY_PUBLIC +data: 08pr801Ep2WSQyE8xA/xSOCQedcq050eMt/XCXEgp7pCo21DVWGcrgmk8+77p15EJ0r1ToWWcizAO8A7 + +--- +# drone encrypt Weko/lestoitsduval-alerting $MJ_APIKEY_PRIVATE +kind: secret +name: MJ_APIKEY_PRIVATE +data: FgCqJJHfmQ8L504tfjxyRcHY1K5IV5WqV346ajhIEt/Ahwds3WAUcvTI5UB+0vR5m8YekrIF1qe8cmkv + +--- +kind: pipeline +type: docker +name: prod + +steps: +- name: Test en prod + image: node:current-alpine + environment: + MJ_APIKEY_PUBLIC: + from_secret: MJ_APIKEY_PUBLIC + MJ_APIKEY_PRIVATE: + from_secret: MJ_APIKEY_PRIVATE + commands: + - TZ=Europe/Paris node index.js + +- name: notify + image: plugins/matrix@sha256:f1affb31b0c86963c97c6f976fa0dcb3cc84272057fd8558d609d28b3064bd7f + settings: + homeserver: https://converser.eu + roomid: "QwOITmkKxRJJyCSDOZ:converser.eu" + userid: "resilien:converser.eu" + accesstoken: + from_secret: MATRIX_ACCESSTOKEN + when: + status: [ failure ] diff --git a/index.js b/index.js index 48d3744..bae821a 100644 --- a/index.js +++ b/index.js @@ -71,3 +71,4 @@ if (secondDifference > (6 * 60)) { } else { console.log(`✅ L'installation répond correctement dernière mise à jour il y a ${secondDifference} secondes.`); } +await sendAlert();