diff --git a/Jenkinsfile b/Jenkinsfile index 6048eaca5..118f206a6 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -85,29 +85,12 @@ pipeline { docker { image 'springci/spring-data-openjdk8-with-redis-6.0:latest' label 'data' - args '-v $HOME/.m2:/tmp/jenkins-home/.m2' + args '-u root -v $HOME/.m2:/tmp/jenkins-home/.m2' } } options { timeout(time: 30, unit: 'MINUTES') } steps { - // Create link to directory with Redis binaries - sh 'ln -sf /work' - - // Launch Redis in proper configuration - sh 'make start' - - // Execute maven test - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean test -DrunLongTests=true -U -B' - - // Capture resulting exit code from maven (pass/fail) - sh 'RESULT=\$?' - - // Shutdown Redis - sh 'make stop' - - // Return maven results - sh 'exit \$RESULT' - + sh 'PROFILE=none LONG_TESTS=true ci/test.sh' } } @@ -124,29 +107,12 @@ pipeline { docker { image 'springci/spring-data-openjdk11-with-redis-6.0:latest' label 'data' - args '-v $HOME/.m2:/tmp/jenkins-home/.m2' + args '-u root -v $HOME/.m2:/tmp/jenkins-home/.m2' } } options { timeout(time: 30, unit: 'MINUTES') } steps { - // Create link to directory with Redis binaries - sh 'ln -sf /work' - - // Launch Redis in proper configuration - sh 'make start' - - // Execute maven test - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean test -U -B' - - // Capture resulting exit code from maven (pass/fail) - sh 'RESULT=\$?' - - // Shutdown Redis - sh 'make stop' - - // Return maven results - sh 'exit \$RESULT' - + sh 'PROFILE=java11 ci/test.sh' } } stage("test: baseline (jdk15)") { @@ -154,29 +120,12 @@ pipeline { docker { image 'springci/spring-data-openjdk15-with-redis-6.0:latest' label 'data' - args '-v $HOME/.m2:/tmp/jenkins-home/.m2' + args '-u root -v $HOME/.m2:/tmp/jenkins-home/.m2' } } options { timeout(time: 30, unit: 'MINUTES') } steps { - // Create link to directory with Redis binaries - sh 'ln -sf /work' - - // Launch Redis in proper configuration - sh 'make start' - - // Execute maven test - sh 'MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw -Pjava11 clean test -U -B' - - // Capture resulting exit code from maven (pass/fail) - sh 'RESULT=\$?' - - // Shutdown Redis - sh 'make stop' - - // Return maven results - sh 'exit \$RESULT' - + sh 'PROFILE=java11 ci/test.sh' } } } diff --git a/ci/test.sh b/ci/test.sh new file mode 100755 index 000000000..9d7f117a8 --- /dev/null +++ b/ci/test.sh @@ -0,0 +1,23 @@ +#!/bin/bash -x + +set -euo pipefail + +rm -f work + +# Create link to directory with Redis binaries +cwd=$(pwd) + +# Launch Redis in proper configuration +pushd / && make -f $cwd/Makefile start && popd + +# Execute maven test +MAVEN_OPTS="-Duser.name=jenkins -Duser.home=/tmp/jenkins-home" ./mvnw clean test -P${PROFILE} -DrunLongTests=${LONG_TESTS:-false} -U -B -Dmaven.repo.local=/tmp/jenkins-home/.m2/spring-data-redis + +# Capture resulting exit code from maven (pass/fail) +RESULT=$? + +# Shutdown Redis +pushd / && make -f $cwd/Makefile stop && popd + +# Return maven results +exit $RESULT \ No newline at end of file