1
0

master.jenkins 898 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!groovy
  2. pipeline {
  3. agent {
  4. label 'master'
  5. }
  6. options {
  7. timestamps()
  8. }
  9. stages {
  10. stage("build project") {
  11. steps {
  12. sh 'go build main.go webPage.go'
  13. }
  14. }
  15. stage("deploy docker") {
  16. steps{
  17. sh 'docker-compose stop schedule'
  18. sh 'docker-compose up --build -d'
  19. }
  20. }
  21. }
  22. post {
  23. success {
  24. echo 'I succeeeded!'
  25. sh 'cat $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/log > /tmp/success.log'
  26. sh 'sed '/8mha/d' success.log >> new.log' >> new.log
  27. sh 'getlog --file new.log'
  28. }
  29. unstable {
  30. echo 'I am unstable :/'
  31. }
  32. failure {
  33. echo 'I failed :((('
  34. sh 'cat $JENKINS_HOME/jobs/$JOB_NAME/builds/$BUILD_NUMBER/log > /tmp/fail.log'
  35. }
  36. changed {
  37. echo 'things were different before...'
  38. }
  39. }
  40. }