Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.72 KB | None | 0 0
  1. #!/usr/bin/env groovy
  2. // Run in the default ’master’ node
  3. node() {
  4.  
  5. //TODO
  6. //tomcat = new com.cb.web.Tomcat(hostname: "localhost", port: "8180", adminUser: "admin", adminPassword: "tomcat")
  7. // Local variables
  8. //artifactName = 'webapp.war'
  9. //artifact = "target/${artifactName}"
  10.  
  11. stage 'checkout'
  12. // Checkout code from repository and update any submodules
  13. checkout scm
  14.  
  15. parallel(
  16. 'build':{
  17. if (isUnix()) {
  18. sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; gradle build'
  19. } else {
  20. bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle build'
  21. }
  22. },
  23. 'test':{
  24. if (isUnix()) {
  25. sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/; ./gradlew test'
  26. } else {
  27. bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle test'
  28. }
  29. },
  30. 'javadoc':{
  31. if (isUnix()) {
  32. sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew javadoc'
  33. } else {
  34. bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle javadoc'
  35. }
  36. },
  37. 'jacocoTestReport':{
  38. if (isUnix()) {
  39. sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew jacocoTestReport'
  40. } else {
  41. bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle jacocoTestReport'
  42. }
  43. },
  44. 'integrationTest':{
  45. if (isUnix()) {
  46. sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew integrationTest'
  47. } else {
  48. bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle integrationTest'
  49. }
  50. },
  51. 'jacocoIntegrationReport':{
  52. if (isUnix()) {
  53. sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew jacocoIntegrationReport'
  54. } else {
  55. bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle jacocoIntegrationReport'
  56. }
  57. }
  58. )
  59.  
  60. stage 'archive'
  61. archiveArtifacts artifacts: 'odsoft/Exercise4/alternative/cms/build/docs/javadoc/*.html'
  62. archiveArtifacts artifacts: 'odsoft/Exercise4/alternative/cms/build/libs/cms-1.0.war'
  63. archiveArtifacts artifacts: 'odsoft/Exercise4/alternative/cms/build/reports/jacoco/test/*.xml'
  64.  
  65. stage 'deploy Tomcat'
  66. if (isUnix()) {
  67. sh 'cp odsoft/Exercise4/alternative/cms/build/libs/cms-1.0.war /usr/local/apache-tomcat-7.0.82/webapps/'
  68. }else{
  69. bat 'copy odsoft/Exercise4/alternative/cms/build/libs/cms-1.0.war %CATALINA_HOME%/webapps/ /y'
  70. }
  71.  
  72. stage 'smoke test'
  73.  
  74. sh 'curl -I -s -L http://localhost:8085/cms-1.0 | grep "HTTP/1.1"'
  75.  
  76. stage 'Deploy Approval'
  77. input "Deploy to production?"
  78.  
  79. // tomcat.deploy(artifact, 'staging', deployClosure)
  80.  
  81.  
  82. // stage('Push') {
  83. // withEnv(["PATH=${workspace}/cf-cli:$PATH"]) {
  84. // sh 'cf login -u $CF_USERNAME -p $CF_PASSWORD -a $CF_API_ENDPOINT -o $CF_ORGANIZATION -s $CF_SPACE --skip-ssl-validation'
  85. // dir("tomcat-config-repo") {
  86. // // push the app to PCF using default/existing healthchecks
  87. // sh "cf push tomcat-config-repo --no-start"
  88.  
  89. // // set the health check endpoint we should test this app with and restart to verify it's health
  90. // sh "cf set-health-check tomcat-config-repo http --endpoint /index.yml"
  91.  
  92. // sh "cf restart tomcat-config-repo"
  93. // }
  94. // sh 'cf apps'
  95. // }
  96. // }
  97.  
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement