Skip to content
Somkiat Puisungnoen edited this page Nov 13, 2020 · 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'
            }
        }
    }
}

Clone this wiki locally