Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env groovy
- // Run in the default ’master’ node
- node() {
- //TODO
- //tomcat = new com.cb.web.Tomcat(hostname: "localhost", port: "8180", adminUser: "admin", adminPassword: "tomcat")
- // Local variables
- //artifactName = 'webapp.war'
- //artifact = "target/${artifactName}"
- stage 'checkout'
- // Checkout code from repository and update any submodules
- checkout scm
- parallel(
- 'build':{
- if (isUnix()) {
- sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; gradle build'
- } else {
- bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle build'
- }
- },
- 'test':{
- if (isUnix()) {
- sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/; ./gradlew test'
- } else {
- bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle test'
- }
- },
- 'javadoc':{
- if (isUnix()) {
- sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew javadoc'
- } else {
- bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle javadoc'
- }
- },
- 'jacocoTestReport':{
- if (isUnix()) {
- sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew jacocoTestReport'
- } else {
- bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle jacocoTestReport'
- }
- },
- 'integrationTest':{
- if (isUnix()) {
- sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew integrationTest'
- } else {
- bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle integrationTest'
- }
- },
- 'jacocoIntegrationReport':{
- if (isUnix()) {
- sh 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ ; ./gradlew jacocoIntegrationReport'
- } else {
- bat 'cd $WORKSPACE/odsoft/Exercise4/alternative/cms/ & gradle jacocoIntegrationReport'
- }
- }
- )
- stage 'archive'
- archiveArtifacts artifacts: 'odsoft/Exercise4/alternative/cms/build/docs/javadoc/*.html'
- archiveArtifacts artifacts: 'odsoft/Exercise4/alternative/cms/build/libs/cms-1.0.war'
- archiveArtifacts artifacts: 'odsoft/Exercise4/alternative/cms/build/reports/jacoco/test/*.xml'
- stage 'deploy Tomcat'
- if (isUnix()) {
- sh 'cp odsoft/Exercise4/alternative/cms/build/libs/cms-1.0.war /usr/local/apache-tomcat-7.0.82/webapps/'
- }else{
- bat 'copy odsoft/Exercise4/alternative/cms/build/libs/cms-1.0.war %CATALINA_HOME%/webapps/ /y'
- }
- stage 'smoke test'
- sh 'curl -I -s -L http://localhost:8085/cms-1.0 | grep "HTTP/1.1"'
- stage 'Deploy Approval'
- input "Deploy to production?"
- // tomcat.deploy(artifact, 'staging', deployClosure)
- // stage('Push') {
- // withEnv(["PATH=${workspace}/cf-cli:$PATH"]) {
- // sh 'cf login -u $CF_USERNAME -p $CF_PASSWORD -a $CF_API_ENDPOINT -o $CF_ORGANIZATION -s $CF_SPACE --skip-ssl-validation'
- // dir("tomcat-config-repo") {
- // // push the app to PCF using default/existing healthchecks
- // sh "cf push tomcat-config-repo --no-start"
- // // set the health check endpoint we should test this app with and restart to verify it's health
- // sh "cf set-health-check tomcat-config-repo http --endpoint /index.yml"
- // sh "cf restart tomcat-config-repo"
- // }
- // sh 'cf apps'
- // }
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement