@ -26,19 +26,26 @@ def setupGradle() {
@@ -26,19 +26,26 @@ def setupGradle() {
}
def doValidation() {
sh '''
sh """
./gradlew -PscalaVersion=$SCALA_VERSION clean compileJava compileScala compileTestJava compileTestScala \
spotlessScalaCheck checkstyleMain checkstyleTest spotbugsMain rat \
--profile --no-daemon --continue -PxmlSpotBugsReport=true
'''
"""
}
def doTest(target = "unitTest integrationTest") {
sh """
./gradlew -PscalaVersion=$SCALA_VERSION ${target} \
--profile --no-daemon --continue -PtestLoggingEvents=started,passed,skipped,failed \
-PignoreFailures=true -PmaxParallelForks=2 -PmaxTestRetries=1 -PmaxTestRetryFailures=5
"""
def isChangeRequest(env) {
env.CHANGE_ID != null && !env.CHANGE_ID.isEmpty()
}
def retryFlagsString(env) {
if (isChangeRequest(env)) " -PmaxTestRetries=1 -PmaxTestRetryFailures=5"
else ""
}
def doTest(env, target = "unitTest integrationTest") {
sh """./gradlew -PscalaVersion=$SCALA_VERSION ${target} \
--profile --no-daemon --continue -PtestLoggingEvents=started,passed,skipped,failed \
-PignoreFailures=true -PmaxParallelForks=2""" + retryFlagsString(env)
junit '**/build/test-results/**/TEST-*.xml'
}
@ -95,10 +102,16 @@ def tryStreamsArchetype() {
@@ -95,10 +102,16 @@ def tryStreamsArchetype() {
pipeline {
agent none
options {
disableConcurrentBuilds()
}
stages {
stage('Build') {
parallel {
stage('JDK 8') {
stage('JDK 8 and Scala 2.12') {
agent { label 'ubuntu' }
tools {
jdk 'jdk_1.8_latest'
@ -114,12 +127,12 @@ pipeline {
@@ -114,12 +127,12 @@ pipeline {
steps {
setupGradle()
doValidation()
doTest()
doTest(env )
tryStreamsArchetype()
}
}
stage('JDK 11') {
stage('JDK 11 and Scala 2.13 ') {
agent { label 'ubuntu' }
tools {
jdk 'jdk_11_latest'
@ -134,12 +147,12 @@ pipeline {
@@ -134,12 +147,12 @@ pipeline {
steps {
setupGradle()
doValidation()
doTest()
doTest(env )
echo 'Skipping Kafka Streams archetype test for Java 11'
}
}
stage('JDK 15') {
stage('JDK 15 and Scala 2.13 ') {
agent { label 'ubuntu' }
tools {
jdk 'jdk_15_latest'
@ -154,7 +167,7 @@ pipeline {
@@ -154,7 +167,7 @@ pipeline {
steps {
setupGradle()
doValidation()
doTest()
doTest(env )
echo 'Skipping Kafka Streams archetype test for Java 15'
}
}
@ -172,11 +185,102 @@ pipeline {
@@ -172,11 +185,102 @@ pipeline {
setupGradle()
doValidation()
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
doTest('unitTest')
doTest(env, 'unitTest')
}
echo 'Skipping Kafka Streams archetype test for ARM build'
}
}
// To avoid excessive Jenkins resource usage, we only run the stages
// above at the PR stage. The ones below are executed after changes
// are pushed to trunk and/or release branches. We achieve this via
// the `when` clause.
stage('JDK 8 and Scala 2.13') {
when {
not { changeRequest() }
beforeAgent true
}
agent { label 'ubuntu' }
tools {
jdk 'jdk_1.8_latest'
maven 'maven_3_latest'
}
options {
timeout(time: 8, unit: 'HOURS')
timestamps()
}
environment {
SCALA_VERSION=2.13
}
steps {
setupGradle()
doValidation()
doTest(env)
tryStreamsArchetype()
}
}
stage('JDK 11 and Scala 2.12') {
when {
not { changeRequest() }
beforeAgent true
}
agent { label 'ubuntu' }
tools {
jdk 'jdk_11_latest'
}
options {
timeout(time: 8, unit: 'HOURS')
timestamps()
}
environment {
SCALA_VERSION=2.12
}
steps {
setupGradle()
doValidation()
doTest(env)
echo 'Skipping Kafka Streams archetype test for Java 11'
}
}
stage('JDK 15 and Scala 2.12') {
when {
not { changeRequest() }
beforeAgent true
}
agent { label 'ubuntu' }
tools {
jdk 'jdk_15_latest'
}
options {
timeout(time: 8, unit: 'HOURS')
timestamps()
}
environment {
SCALA_VERSION=2.12
}
steps {
setupGradle()
doValidation()
doTest(env)
echo 'Skipping Kafka Streams archetype test for Java 15'
}
}
}
}
}
post {
always {
script {
if (!isChangeRequest(env)) {
step([$class: 'Mailer',
notifyEveryUnstableBuild: true,
recipients: "dev@kafka.apache.org",
sendToIndividuals: false])
}
}
}
}