Jenkinsfile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. pipeline {
  2. agent {
  3. label "swarm"
  4. }
  5. environment {
  6. git_url=""
  7. }
  8. parameters {
  9. booleanParam(
  10. name: "build",
  11. defaultValue: true,
  12. description: "To build image set built to 'true'. To not build - set parameter to 'false'."
  13. )
  14. string(
  15. name: "repo",
  16. defaultValue: "prod",
  17. description: "Repository to build and/or deploy from."
  18. )
  19. string(
  20. name: "service_update",
  21. defaultValue: "",
  22. description: "Services to update - i.e. info_node or/and info_node-api. Lave empty to not update services."
  23. )
  24. }
  25. stages {
  26. stage("Build") {
  27. // when { expression { build_repo != "none" } }
  28. when { build }
  29. steps {
  30. echo "Building with repo $repo"
  31. sh '''pwd
  32. ls'''
  33. }
  34. }
  35. stage("Update") {
  36. when { expression { service_update != "" } }
  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. }