Jenkinsfile 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. String cron_string = BRANCH_NAME == "master" ? "@daily" : ""
  2. pipeline {
  3. agent any
  4. triggers {
  5. pollSCM('* * * * *')
  6. cron(cron_string)
  7. }
  8. stages {
  9. stage('Build') {
  10. steps {
  11. sh 'make build'
  12. }
  13. }
  14. stage('Unit Tests') {
  15. steps {
  16. sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_unit'
  17. }
  18. }
  19. stage('Acceptance Tests') {
  20. steps {
  21. sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_acceptance'
  22. }
  23. }
  24. stage('Package and publish build') {
  25. steps {
  26. sh 'make publish'
  27. }
  28. }
  29. stage('Publish build number') {
  30. steps {
  31. sh 'echo ${BRANCH_NAME}-${BUILD_NUMBER} > build_number.txt'
  32. withAWS(credentials:'S3_CI_BUILDS_AWS_KEYS', region:"${S3_REGION_BUILD_ARTEFACTS}") {
  33. // The deployment process uses this file to figure out the latest build
  34. s3Upload(file:'build_number.txt', bucket:"${S3_BUCKET_BUILD_ARTEFACTS}", path:"${JOB_NAME}/latest")
  35. }
  36. }
  37. }
  38. }
  39. post {
  40. always {
  41. sh 'DOCKER_COMPOSE_FLAGS="-f docker-compose.ci.yml" make test_clean'
  42. }
  43. failure {
  44. mail(from: "${EMAIL_ALERT_FROM}",
  45. to: "${EMAIL_ALERT_TO}",
  46. subject: "Jenkins build failed: ${JOB_NAME}:${BUILD_NUMBER}",
  47. body: "Build: ${BUILD_URL}")
  48. }
  49. }
  50. // The options directive is for configuration that applies to the whole job.
  51. options {
  52. // we'd like to make sure remove old builds, so we don't fill up our storage!
  53. buildDiscarder(logRotator(numToKeepStr:'50'))
  54. // And we'd really like to be sure that this build doesn't hang forever, so let's time it out after:
  55. timeout(time: 30, unit: 'MINUTES')
  56. }
  57. }