jenkinsfile 946 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!groovy
  2. def GetLog(build_url) {
  3. def logurl = build_url + 'consoleText'
  4. def strip = logurl.replaceAll('http://','')
  5. withCredentials([string(credentialsId: 'JenkinsAPI', variable: 'token')]){
  6. responce = httpRequest(httpMode: 'GET',
  7. url: 'http://admin:QWEasd123@' + strip)
  8. return strip
  9. }
  10. }
  11. pipeline {
  12. agent {
  13. label 'master'
  14. }
  15. stages {
  16. stage("build project") {
  17. steps {
  18. echo 'go build main.go webPage.go'
  19. }
  20. }
  21. stage("deploy docker") {
  22. steps{
  23. echo 'docker-compose stop schedule'
  24. echo '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. }