jenkinsfile 874 B

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