Explorar el Código

Обновить 'Jenkins/jenkinsfile'

vmshay hace 5 años
padre
commit
950adbc2c4
Se han modificado 1 ficheros con 12 adiciones y 1 borrados
  1. 12 1
      Jenkins/jenkinsfile

+ 12 - 1
Jenkins/jenkinsfile

@@ -10,6 +10,17 @@ def GetLog(build_url) {
 	}
 }
 
+def sendMessage(message){
+	def encode = URLEncoder.encode(message,"UTF-8")
+	withCredentials([string(credentialsId: 'TGBot', variable: 'SECRET')]) {
+	responce = httpRequest(contentType: 'APPLICATION_JSON',
+		httpMode: 'GET',
+		url: "https://api.telegram.org/bot$SECRET/sendMessage?text=$encode&chat_id=-1001282104904&disable_web_page_preview=true",
+		validResponceCodes: '200')
+		return responce
+	}
+}
+
 pipeline {
     agent {
        label 'master'
@@ -39,7 +50,7 @@ pipeline {
       }
       failure {
         echo 'I failed :((('
-        GetLog("${BUILD_URL}")
+        sendMessage(GetLog("${BUILD_URL}"))
       }
       changed {
         echo 'things were different before...'