#!groovy def GetLog(build_url) { def logurl = build_url + 'consoleText' def strip = logurl.replaceAll('http://','') def creds = "admin:QWEasd123" def auth = creds.bytes.encodeBase64().toString() withCredentials([string(credentialsId: 'JenkinsAPI', variable: 'token')]){ responce = httpRequest(contentType: 'APPLICATION_JSON', httpMode: 'GET', url: 'http://' + strip, customHeaders:[[name:'Authorization', value:"Basic ${auth}"]]) return strip } } 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!' echo GetLog("${BUILD_URL}") } unstable { echo 'I am unstable :/' } failure { echo 'I failed :(((' echo GetLog("${BUILD_URL}") } changed { echo 'things were different before...' } } }