Jenkinsfile 1.2 KB

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