Advertisement
Guest User

Untitled

a guest
Mar 8th, 2017
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. #!groovy
  2.  
  3. def application, manifest, git, environment, artifactory, sonar
  4.  
  5. fileLoader.withGit('git@<reducted>', 'v1', '<reducted>') {
  6. application = fileLoader.load('<reducted>');
  7. manifest = fileLoader.load('<reducted>');
  8. git = fileLoader.load('<reducted>');
  9. environment = fileLoader.load('<reducted>');
  10. //artifactory = fileLoader.load('<reducted>');
  11. //sonar = fileLoader.load('<reducted>');
  12. }
  13.  
  14. // def deployStage = environment.<reducted>()
  15. // def artifactoryServer = artifactory.getArtifactoryServerName()
  16. def projectName = null
  17. def githubOrg = null
  18. def gitCommit = null
  19.  
  20. pipeline {
  21. agent { label 'cf_slave' }
  22.  
  23. options {
  24. skipDefaultCheckout()
  25. }
  26.  
  27. stages {
  28. stage ("Checkout SCM") {
  29. steps {
  30. checkout scm
  31.  
  32. script {
  33. projectName = git.getGitRepositoryName()
  34. githubOrg = git.getGitOrgName()
  35. gitCommit = manifest.getGitCommit()
  36. }
  37. }
  38. }
  39.  
  40. stage ("Unit tests") {
  41. steps {
  42. sh "./node_modules/.bin/mocha --reporter mocha-junit-reporter --reporter-options mochaFile=./testResults/results.xml"
  43. junit allowEmptyResults: true, testResults: 'testResults/results.xml'
  44. }
  45. }
  46.  
  47. stage ("SonarQube analysis (TODO)") {
  48. steps {
  49. //sonar.replaceTokensAndRunScanner(githubOrg, projectName)
  50. echo "SonarQube analysis - todo"
  51. }
  52. }
  53.  
  54. stage("Simple publication (INACTIVE)") {
  55. steps {
  56. echo "Simple publication - inactive"
  57. // Login
  58. //sh "cf api <reducted>"
  59. //sh "cf login -u <reducted> -p <reducted>"
  60.  
  61. // Deploy
  62. //sh "cf push"
  63. }
  64. }
  65. }
  66.  
  67. post {
  68. success {
  69. sh "echo 'Pipeline reached the finish line!'"
  70.  
  71. // Notify in Slack
  72. slackSend color: 'yellow', message: "The Pipeline operation completed successfully. You can check results here: <reducted>"
  73. }
  74. failure {
  75. sh "echo 'Pipeline failed'"
  76.  
  77. // Notify in Slack
  78. slackSend color: 'red', message: "One of the Pipeline stages failed. Check the log file: <reducted>"
  79.  
  80. //Clean the execution workspace
  81. deleteDir()
  82. }
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement