mirror of https://github.com/apache/kafka.git
KAFKA-12614: Use Jenkinsfile for trunk and release branch builds (#10473)
* Run all JDK/Scala version combinations for trunk/release branch builds. * Only retry failures in PR builds for now (we can remove this distinction if/when we report flaky failures as described in KAFKA-12216). * Disable concurrent builds * Send email to dev list on build failure * Use triple double quotes in `doValidation` since we use string interpolation for `SCALA_VERSION`. * Update release.py to output new `Unit/integration tests` Jenkins link Reviewers: Gwen Shapira <cshapi@gmail.com>, David Arthur <mumrah@gmail.com>
This commit is contained in:
parent
136f584c05
commit
161c5638b8
|
@ -26,19 +26,26 @@ def setupGradle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
def doValidation() {
|
def doValidation() {
|
||||||
sh '''
|
sh """
|
||||||
./gradlew -PscalaVersion=$SCALA_VERSION clean compileJava compileScala compileTestJava compileTestScala \
|
./gradlew -PscalaVersion=$SCALA_VERSION clean compileJava compileScala compileTestJava compileTestScala \
|
||||||
spotlessScalaCheck checkstyleMain checkstyleTest spotbugsMain rat \
|
spotlessScalaCheck checkstyleMain checkstyleTest spotbugsMain rat \
|
||||||
--profile --no-daemon --continue -PxmlSpotBugsReport=true
|
--profile --no-daemon --continue -PxmlSpotBugsReport=true
|
||||||
'''
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
def doTest(target = "unitTest integrationTest") {
|
def isChangeRequest(env) {
|
||||||
sh """
|
env.CHANGE_ID != null && !env.CHANGE_ID.isEmpty()
|
||||||
./gradlew -PscalaVersion=$SCALA_VERSION ${target} \
|
}
|
||||||
--profile --no-daemon --continue -PtestLoggingEvents=started,passed,skipped,failed \
|
|
||||||
-PignoreFailures=true -PmaxParallelForks=2 -PmaxTestRetries=1 -PmaxTestRetryFailures=5
|
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'
|
junit '**/build/test-results/**/TEST-*.xml'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,10 +102,16 @@ def tryStreamsArchetype() {
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent none
|
agent none
|
||||||
|
|
||||||
|
options {
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Build') {
|
stage('Build') {
|
||||||
parallel {
|
parallel {
|
||||||
stage('JDK 8') {
|
|
||||||
|
stage('JDK 8 and Scala 2.12') {
|
||||||
agent { label 'ubuntu' }
|
agent { label 'ubuntu' }
|
||||||
tools {
|
tools {
|
||||||
jdk 'jdk_1.8_latest'
|
jdk 'jdk_1.8_latest'
|
||||||
|
@ -114,12 +127,12 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
setupGradle()
|
setupGradle()
|
||||||
doValidation()
|
doValidation()
|
||||||
doTest()
|
doTest(env)
|
||||||
tryStreamsArchetype()
|
tryStreamsArchetype()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('JDK 11') {
|
stage('JDK 11 and Scala 2.13') {
|
||||||
agent { label 'ubuntu' }
|
agent { label 'ubuntu' }
|
||||||
tools {
|
tools {
|
||||||
jdk 'jdk_11_latest'
|
jdk 'jdk_11_latest'
|
||||||
|
@ -134,12 +147,12 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
setupGradle()
|
setupGradle()
|
||||||
doValidation()
|
doValidation()
|
||||||
doTest()
|
doTest(env)
|
||||||
echo 'Skipping Kafka Streams archetype test for Java 11'
|
echo 'Skipping Kafka Streams archetype test for Java 11'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('JDK 15') {
|
stage('JDK 15 and Scala 2.13') {
|
||||||
agent { label 'ubuntu' }
|
agent { label 'ubuntu' }
|
||||||
tools {
|
tools {
|
||||||
jdk 'jdk_15_latest'
|
jdk 'jdk_15_latest'
|
||||||
|
@ -154,7 +167,7 @@ pipeline {
|
||||||
steps {
|
steps {
|
||||||
setupGradle()
|
setupGradle()
|
||||||
doValidation()
|
doValidation()
|
||||||
doTest()
|
doTest(env)
|
||||||
echo 'Skipping Kafka Streams archetype test for Java 15'
|
echo 'Skipping Kafka Streams archetype test for Java 15'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,11 +185,102 @@ pipeline {
|
||||||
setupGradle()
|
setupGradle()
|
||||||
doValidation()
|
doValidation()
|
||||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {
|
||||||
doTest('unitTest')
|
doTest(env, 'unitTest')
|
||||||
}
|
}
|
||||||
echo 'Skipping Kafka Streams archetype test for ARM build'
|
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])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -731,7 +731,7 @@ https://kafka.apache.org/%(docs_version)s/documentation.html
|
||||||
https://kafka.apache.org/%(docs_version)s/protocol.html
|
https://kafka.apache.org/%(docs_version)s/protocol.html
|
||||||
|
|
||||||
* Successful Jenkins builds for the %(dev_branch)s branch:
|
* Successful Jenkins builds for the %(dev_branch)s branch:
|
||||||
Unit/integration tests: https://builds.apache.org/job/kafka-%(dev_branch)s-jdk8/<BUILD NUMBER>/
|
Unit/integration tests: https://ci-builds.apache.org/job/Kafka/job/kafka/job/%(dev_branch)s/<BUILD NUMBER>/
|
||||||
System tests: https://jenkins.confluent.io/job/system-test-kafka/job/%(dev_branch)s/<BUILD_NUMBER>/
|
System tests: https://jenkins.confluent.io/job/system-test-kafka/job/%(dev_branch)s/<BUILD_NUMBER>/
|
||||||
|
|
||||||
/**************************************
|
/**************************************
|
||||||
|
|
Loading…
Reference in New Issue