12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #!groovy
- def GetLog(build_url) {
- def logurl = build_url + 'consoleText'
- def strip = logurl.replaceAll('http://','')
- withCredentials([string(credentialsId: 'JenkinsAPI', variable: 'token')]){
- responce = httpRequest(httpMode: 'GET',
- url: 'http//admin:token@strip')
- return strip
- }
- }
- pipeline {
- agent {
- label 'master'
- }
- stages {
- stage("build project") {
- steps {
- sh 'go build main.go webPage.go'
- }
- }
- stage("deploy docker") {
- steps{
- sh 'docker-compose stop schedule'
- sh 'docker-compose up --build -d'
- }
- }
- }
- post {
- success {
- echo 'I succeeeded!'
-
- }
- unstable {
- echo 'I am unstable :/'
- }
- failure {
- echo 'I failed :((('
- echo GetLog("${BUILD_URL}")
- }
- changed {
- echo 'things were different before...'
- }
- }
- }
|