jenkinsfile 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. <<<<<<< HEAD
  36. echo GetLog()
  37. =======
  38. sh 'curl "${BUILD_URL}/consoleText" > /tmp/test.txt'
  39. >>>>>>> 5518cc11c8ddaf2485f2e6e569815856ea1619fc
  40. }
  41. changed {
  42. echo 'things were different before...'
  43. }
  44. }
  45. }