2
votes

I am new to Docker and currently working on a project which uses docker for build and deployment. I have installed Docker for windows on my Windows 10 machine and currently running docker in windows environment.

I am using Jenkins for creating the docker image for a project which has Integration tests coded inside it.

I need to create new Job in Jenkins which will take docker image from previous job and run Integration tests on this image and not on the code base. I am not sure if we can do it for Windows. I have searched online but have not found any articles or tutorials which explain how to achieve this.

Can someone help me with this problem or guide me to a solution which i can refer.

Thanks

Vikeng

1
Assuming gradle, running the tests woulnd't be as simple as: docker run your-image:version ./gradlew integrationTests ?gmaslowski

1 Answers

1
votes

Your question is a few months old, but still :)

You can have a look at the Fabric8 Docker Maven Plugin https://dmp.fabric8.io/ It integrates very well with the Maven workflow: you describe how to build your image (with a DockerFile or in the pom directly), as well as how to run it (in a 'docker run' manner or with a docker-compose.yaml). Of course, Windows is supported, since it is your use case :)

Then, the phases of the plugin integrate well, the build of the image is made at the 'package' phase, and the containers are started at 'pre-integration' and stopped and removed at 'post-integration'.

One small thing to remember is if you have a multi-module project, the integration tests are run by module, so if you have several images that integrate together, make sure to define them in the same pom.

Hope this helps