DATAREDIS-1220 - Migrate to running CI test jobs as root.

To avoid permission issues with Redis, run the container as root. Apply proper measures so that maven caching doesn't break other users of the same agents.
This commit is contained in:
Greg L. Turnquist
2020-11-03 16:21:36 -06:00
parent 28949447b1
commit b71367f051
2 changed files with 29 additions and 57 deletions

63
Jenkinsfile vendored
View File

@@ -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'
}
}
}

23
ci/test.sh Executable file
View File

@@ -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