Jenkinsfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. To not build - set parameter to 'none'."
  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 { expression { build_repo != "none" } }
  20. steps {
  21. echo "Building with repo $build_repo"
  22. sh 'pwd'
  23. }
  24. }
  25. stage("Update") {
  26. when {
  27. allOf {
  28. expression { service_update != null }
  29. expression { not service_update.empty }
  30. }
  31. }
  32. steps {
  33. echo "Updating $service_update"
  34. script {
  35. for (String item : service_update.split()) {
  36. echo "Updating $item"
  37. if ( item=="blabla" ) {
  38. sh 'false'
  39. }
  40. }
  41. }
  42. sh 'ls'
  43. }
  44. }
  45. }
  46. post {
  47. always {
  48. echo "It's always good to be here."
  49. }
  50. changed {
  51. echo "Something changed..."
  52. }
  53. failure {
  54. echo "Oh, snap. It's failed again"
  55. }
  56. success {
  57. echo "Fine !!! It's SUCCESS !!!"
  58. }
  59. unstable {
  60. echo "Unstable ...."
  61. }
  62. aborted {
  63. echo "Hmmm... It's aborted"
  64. }
  65. }
  66. }