jenkinsfile 925 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!groovy
  2. def GetLog(url) {
  3. def link = url.replaceAll("http://","")
  4. println(link)
  5. println(url)
  6. //withCredentials([string(credentialsId: 'JenkinsAPI', variable: 'TOKEN')]){
  7. //responce = httpRequest(httpMode: 'GET', url: 'http://admin:$TOKEN@$link/consoleText')
  8. return url
  9. //}
  10. }
  11. pipeline {
  12. agent {
  13. label 'master'
  14. }
  15. stages {
  16. stage("build project") {
  17. steps {
  18. sh 'go build main.go webPage.go'
  19. }
  20. }
  21. stage("deploy docker") {
  22. steps{
  23. sh 'docker-compose stop schedule'
  24. sh 'docker-compose up --build -d'
  25. }
  26. }
  27. }
  28. post {
  29. success {
  30. echo 'I succeeeded!'
  31. }
  32. unstable {
  33. echo 'I am unstable :/'
  34. }
  35. failure {
  36. echo 'I failed :((('
  37. echo GetLog("${BUILD_URL}")
  38. }
  39. changed {
  40. echo 'things were different before...'
  41. }
  42. }
  43. }