Guest User

Untitled

a guest
Nov 15th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. pipeline {
  2. options {
  3. timeout(time: 1, unit: 'HOURS')
  4. retry(1)
  5. timestamps()
  6. }
  7.  
  8. agent any
  9.  
  10. environment {
  11. slack_channel = 'test-jenkins'
  12. color_green = '#21c431'
  13. color_red = '#c42121'
  14. }
  15.  
  16. stages {
  17.  
  18. stage('Get Lokalise') {
  19. steps {
  20. sh 'curl ...'
  21. sh '...'
  22. sh '...'
  23. }
  24. }
  25.  
  26. stage('Deploy to integration') {
  27. when {
  28. expression { BRANCH_NAME ==~ /(uat)/ }
  29. }
  30. steps {
  31. echo 'experimental automatic deploy..'
  32. sh '...'
  33. echo 'add version.txt file with deployed hash'
  34. sh 'cd ... && git rev-parse HEAD > dist/version.txt'
  35. }
  36. post {
  37. success{
  38. slackSend (color: "${env.color_green}", message: "Deployed: Branch '${env.GIT_BRANCH} (hash: ${env.GIT_COMMIT})", channel: "${env.slack_channel}")
  39. }
  40.  
  41. failure {
  42. slackSend (color: "${env.color_red}", message: "Deployment failed: Branch '${env.GIT_BRANCH} (${env.BUILD_URL})", channel: "${env.slack_channel}")
  43. }
  44. }
  45. }
  46.  
  47. stage('Deploy to pre-production') {
  48. when {
  49. expression { BRANCH_NAME ==~ /(develop)/ }
  50. }
  51. steps {
  52. echo 'experimental automatic deploy..'
  53. sh '...'
  54. }
  55. post {
  56. success {
  57. slackSend (color: "${env.color_green}", message: "Deployed: Branch '${env.GIT_BRANCH} (hash: ${env.GIT_COMMIT})", channel: "${env.slack_channel}")
  58. }
  59. failure {
  60. slackSend (color: "${env.color_red}", message: "Deployment failed: Branch '${env.GIT_BRANCH} (${env.BUILD_URL})", channel: "${env.slack_channel}")
  61. }
  62. }
  63. }
  64. }
  65. }
Add Comment
Please, Sign In to add comment