jenkinsfile 954 B

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