Jenkinsfile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. pipeline {
  2. agent {
  3. label "swarm"
  4. }
  5. environment {
  6. git_url=""
  7. }
  8. parameters {
  9. string(
  10. name: "build",
  11. defaultValue: "true",
  12. description: "To build image set built to 'true'. To not build, set parameter to anything else - '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 == "true" } }
  28. steps {
  29. echo "Building with repo $repo"
  30. sh '''pwd
  31. ls'''
  32. }
  33. }
  34. stage("Update") {
  35. when { expression { service_update != "" } }
  36. steps {
  37. echo "Updating .$service_update."
  38. script {
  39. for (String item : service_update.split()) {
  40. echo "Updating $item"
  41. }
  42. }
  43. sh 'ls'
  44. }
  45. }
  46. }
  47. post {
  48. always {
  49. echo "It's always good to be here."
  50. }
  51. changed {
  52. echo "Something changed..."
  53. }
  54. failure {
  55. echo "Oh, snap. It's failed again"
  56. }
  57. success {
  58. echo "Fine !!! It's SUCCESS !!!"
  59. }
  60. unstable {
  61. echo "Unstable ...."
  62. }
  63. aborted {
  64. echo "Hmmm... It's aborted"
  65. }
  66. }
  67. }