Jenkinsfile 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. pipeline {
  2. agent {
  3. label "swarm"
  4. }
  5. parameters {
  6. string(
  7. name: "build_repo",
  8. defaultValue: "prod",
  9. description: "Repository to build from. If not presented - build will not run."
  10. )
  11. string(
  12. name: "service_update",
  13. defaultValue: "",
  14. description: "Services to update - i.e. node or/and node-api"
  15. )
  16. }
  17. stages {
  18. stage("Build") {
  19. when {
  20. allOf {
  21. expression { build_repo != null }
  22. expression { not build_repo.empty }
  23. }
  24. }
  25. steps {
  26. echo "Building with repo $build_repo"
  27. sh 'pwd'
  28. }
  29. }
  30. stage("Update") {
  31. when {
  32. allOf {
  33. expression { service_update != null }
  34. expression { not service_update.empty }
  35. }
  36. }
  37. steps {
  38. echo "Updating $service_update"
  39. script {
  40. for (String item : service_update.split()) {
  41. echo "Updating $item"
  42. }
  43. }
  44. sh 'ls'
  45. }
  46. }
  47. }
  48. post {
  49. always {
  50. echo "It's always good to be here."
  51. }
  52. changed {
  53. echo "Something changed..."
  54. }
  55. failure {
  56. echo "Oh, snap. It's failed again"
  57. }
  58. success {
  59. echo "Fine !!! It's SUCCESS !!!"
  60. }
  61. unstable {
  62. echo "Unstable ...."
  63. }
  64. aborted {
  65. echo "Hmmm... It's aborted"
  66. }
  67. }
  68. }