| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 | #!groovydef GetLog(build_url) {    withCredentials([string(credentialsId: 'JenkinsAPI', variable: 'token')]){		def creds = 'admin:' + token		def auth = creds.bytes.encodeBase64().toString()    	responce = httpRequest(httpMode: 'GET',		url: build_url + 'consoleText',		customHeaders:[[name:'Authorization', value:"Basic ${auth}"]],		validResponceCodes: '200')    return responce	}}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'    }    stages {      stage("build project") {        steps {          echo 'go build main.go webPage.go'        }      }      stage("deploy docker") {        steps{          echo 'docker-compose stop schedule'          echo 'docker-compose up --build -d'        }      }     }    post {      success {        echo 'I succeeeded!'        sendMessage(GetLog("${BUILD_URL}"))      }      unstable {        echo 'I am unstable :/'      }      failure {        echo 'I failed :((('        sendMessage(GetLog("${BUILD_URL}"))      }      changed {        echo 'things were different before...'      }    }}
 |