jenkinsfile 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #!groovy
  10. pipeline {
  11. agent {
  12. label 'master'
  13. }
  14. stages {
  15. stage("build project") {
  16. steps {
  17. sh 'go build main.go webPage.go'
  18. }
  19. }
  20. stage("deploy docker") {
  21. steps{
  22. sh 'docker-compose stop schedule'
  23. sh 'docker-compose up --build -d'
  24. }
  25. }
  26. }
  27. post {
  28. success {
  29. echo 'I succeeeded!'
  30. }
  31. unstable {
  32. echo 'I am unstable :/'
  33. }
  34. failure {
  35. echo 'I failed :((('
  36. <<<<<<< HEAD
  37. echo GetLog()
  38. =======
  39. sh 'curl "${BUILD_URL}/consoleText" > /tmp/test.txt'
  40. >>>>>>> 5518cc11c8ddaf2485f2e6e569815856ea1619fc
  41. }
  42. changed {
  43. echo 'things were different before...'
  44. }
  45. }
  46. }