Skip to content
Somkiat Puisungnoen edited this page Jan 5, 2021 · 3 revisions

Pipeline script

pipeline {
    agent any

    stages {
        stage('pull-code') {
            steps {
                git 'https://github.com/up1/workshop-java-web-tdd.git'
            }
        }
        stage('unit-test') {
            steps {
                sh 'mvnw clean test'
                sh 'mvnw cobertura:cobertura'
                junit 'target/surefire-reports/*.xml'
                cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
            }
        }
        stage('build-war') {
            steps {
                sh 'mvnw package -DskipTests=true'
            }
        }
        stage('deploy-tomcat') {
            steps {
                deploy adapters: [tomcat8(credentialsId: '7fb40460-d5c9-4ff3-ba23-c176ae0c48e7', path: '', url: 'http://188.166.209.197:8080/')], contextPath: '/somkiat', war: 'target/demo.war'
            }
        }
    }
}

Parallel pipeline

node {
   stage('pull-code') {  
       git 'https://github.com/up1/workshop-java-web-tdd.git'
   }
   stage('build') {
       sh label: '', script: 'mvnw clean test'
       junit 'target/surefire-reports/*.xml'
   }
   stage('code-coverage') {  
       sh label: '', script: 'mvnw cobertura:cobertura'
       cobertura autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/target/site/cobertura/coverage.xml', conditionalCoverageTargets: '70, 0, 0', failUnhealthy: false, failUnstable: false, lineCoverageTargets: '80, 0, 0', maxNumberOfBuilds: 0, methodCoverageTargets: '80, 0, 0', onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false
   }
   stage('war') {  
       sh label: '', script: 'mvnw package -DskipTests'
   }
   stage('deploy') {
       build 'deploy_new'
   }
   stage('robot') {  
       parallel Chrome: {
            stage ('Chrome'){
            }
        }, Firefox: {
            stage ('Firefox'){
            }
        }, IE: {
            stage ('IE'){
            }
        }
   }
   stage('jmeter') {  
   }
}
Clone this wiki locally