2018-05-31 12:34:34 +02:00
|
|
|
#!groovy
|
|
|
|
|
@Library('github.com/cloudogu/ces-build-lib@ac17d45')
|
|
|
|
|
import com.cloudogu.ces.cesbuildlib.*
|
|
|
|
|
|
|
|
|
|
node() { // No specific label
|
|
|
|
|
|
|
|
|
|
properties([
|
|
|
|
|
// Keep only the last 10 build to preserve space
|
|
|
|
|
buildDiscarder(logRotator(numToKeepStr: '10')),
|
|
|
|
|
// Don't run concurrent builds for a branch, because they use the same workspace directory
|
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
|
])
|
|
|
|
|
|
2018-06-27 11:40:29 +02:00
|
|
|
String defaultEmailRecipients = env.EMAIL_SCM_RECIPIENTS
|
2018-05-31 12:34:34 +02:00
|
|
|
|
|
|
|
|
catchError {
|
|
|
|
|
|
|
|
|
|
Maven mvn = new MavenWrapper(this)
|
|
|
|
|
|
2018-05-31 13:48:09 +02:00
|
|
|
stage('Checkout') {
|
|
|
|
|
checkout scm
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-31 12:34:34 +02:00
|
|
|
stage('Build') {
|
2018-06-07 10:42:25 +02:00
|
|
|
mvn 'clean install -DskipTests'
|
2018-05-31 12:34:34 +02:00
|
|
|
archive '**/target/*.jar,**/target/*.zip'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('Unit Test') {
|
2018-06-07 10:42:25 +02:00
|
|
|
mvn 'test -Dsonia.scm.test.skip.hg=true'
|
2018-05-31 12:34:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stage('SonarQube') {
|
|
|
|
|
def sonarQube = new SonarQube(this, 'ces-sonar')
|
|
|
|
|
|
|
|
|
|
sonarQube.analyzeWith(mvn)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Archive Unit and integration test results, if any
|
|
|
|
|
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml,**/target/jest-reports/TEST-*.xml'
|
|
|
|
|
|
2018-06-27 11:40:29 +02:00
|
|
|
mailIfStatusChanged(defaultEmailRecipients)
|
2018-05-31 12:34:34 +02:00
|
|
|
}
|