@@ -29,23 +29,28 @@ pipeline {
2929 stage(" Test" ) {
3030 environment {
3131 BUNDLE_PATH = " /build/vendor/bundle"
32+ REDIS_URL = " redis://redis-${ env.BUILD_NUMBER} :6379/1"
3233 }
3334 steps {
3435 script {
3536 ruby_bundler_versions. each { versions ->
3637 def ruby_version = versions[0 ]
3738 def bundler_version = versions[1 ]
38- docker. image(" ruby:${ ruby_version} -alpine" )
39- .inside(" -u root --link -v bundle_cache_gem_tests:${ env.BUNDLE_PATH} -v logs_gem_tests:${ env.WORKSPACE} /log" ) {
40- stage(" Prepare test env (ruby ${ ruby_version} )" ) {
41- sh " apk --update --no-cache add build-base git libsodium-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing"
42- sh " gem install bundler:${ bundler_version} "
43- sh ' bundle install --jobs=4 --retry=3'
44- }
45- stage(" Run rspec (ruby ${ ruby_version} )" ) {
46- sh ' bundle exec rspec --format progress --format RspecJunitFormatter --out rspec.xml'
47- }
48- } // end inside
39+ docker. image(' redis' ). withRun() { c_redis ->
40+ docker. image(" ruby:${ ruby_version} -alpine" )
41+ .inside(" -u root --link ${ c_redis.id} :redis-${ env.BUILD_NUMBER} -v bundle_cache_gem_tests:${ env.BUNDLE_PATH} -v logs_gem_tests:${ env.WORKSPACE} /log" ) {
42+ stage(" Prepare test env (ruby ${ ruby_version} )" ) {
43+ sh " apk --update --no-cache add build-base git libsodium-dev --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing"
44+ sh " apk --update add dockerize --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing --allow-untrusted"
45+ sh " gem install bundler:${ bundler_version} "
46+ sh ' bundle install --jobs=4 --retry=3'
47+ sh " dockerize -wait tcp://redis-${ env.BUILD_NUMBER} :6379 -timeout 1m"
48+ }
49+ stage(" Run rspec (ruby ${ ruby_version} )" ) {
50+ sh ' bundle exec rspec --format progress --format RspecJunitFormatter --out rspec.xml'
51+ }
52+ } // end inside
53+ } // end docker redis
4954 } // end ruby_bundler_versions.each
5055 } // end script
5156 } // end steps
0 commit comments