Dependency caching for test execution
Test phase is really slow using the plugin, mainly because I'm unable to cache Maven dependencies.
I'm currently working on this pipeline:
kind: pipeline
type: docker
name: default
steps:
- name: test
image: quay.io/testcontainers/dind-drone-plugin
environment:
CI_WORKSPACE: "/drone/src"
settings:
# This image will run the cmd with your build steps
build_image: maven:3-openjdk-17-slim
# This specifies the command that should be executed to perform build, test and
# integration tests. Not to be confused with Drone's `command`:
cmd: sleep 5 && mvn clean test
prefetch_images:
- "maven:3-openjdk-17-slim"
# volumes:
# - name: maven-repo
# path: /root/.m2
volumes:
- name: dockersock
path: /var/run
- name: build
image: maven:3-openjdk-17-slim
commands:
- mvn clean package -DskipTests
volumes:
- name: maven-repo
path: /root/.m2
# Specify docker:dind as a service
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: { }
- name: maven-repo
host:
path: /home/administrator/drone/cache/maven-repo
maven-repo volume is used as cache for Maven dependencies. It works fine in the build step, but AFAIK it is not possible to use the same approach in test (see the commented lines below prefetch_images).
Moreover, test step downloads the maven:3-openjdk-17-slim image every time it is executed.
The result is test step is taking 11 minutes, while the actual build step only requires 22 seconds.
Is it possible to cache dependencies and use them in a test step with dind or is there another best-practice to improve this performance?
Sorry for the extensive delay - this repo is not under active maintenance.
As per #32 I'm proposing that this repository be formally archived; if you need to continue using it you're welcome to fork, but it's become unviable for me or the Testcontainers team to maintain.