Jenkinsfile 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 { expression { service_update != "" } }
  27. steps {
  28. echo "Updating .$service_update."
  29. script {
  30. for (String item : service_update.split()) {
  31. echo "Updating $item"
  32. if ( item=="blabla" ) {
  33. sh 'false'
  34. }
  35. }
  36. }
  37. sh 'ls'
  38. }
  39. }
  40. }
  41. post {
  42. always {
  43. echo "It's always good to be here."
  44. }
  45. changed {
  46. echo "Something changed..."
  47. }
  48. failure {
  49. echo "Oh, snap. It's failed again"
  50. }
  51. success {
  52. echo "Fine !!! It's SUCCESS !!!"
  53. }
  54. unstable {
  55. echo "Unstable ...."
  56. }
  57. aborted {
  58. echo "Hmmm... It's aborted"
  59. }
  60. }
  61. }