Jenkinsfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. // service_update.split()
  39. echo "Updating $service_update"
  40. script {
  41. for (String item : service_update.split()) {
  42. echo item
  43. }
  44. }
  45. sh 'ls'
  46. }
  47. }
  48. }
  49. post {
  50. always {
  51. echo "It's always good to be here."
  52. }
  53. changed {
  54. echo "Something changed..."
  55. }
  56. failure {
  57. echo "Oh, snap. It's failed again"
  58. }
  59. success {
  60. echo "Fine !!! It's SUCCESS !!!"
  61. }
  62. unstable {
  63. echo "Unstable ...."
  64. }
  65. aborted {
  66. echo "Hmmm... It's aborted"
  67. }
  68. }
  69. }