Run tests inside Docker container with Jenkins

29 visningar
Hoppa till det första olästa meddelandet

Yevhenii Kurtov

oläst,
28 juli 2016 07:02:502016-07-28
till Jenkins Users
We want to give it a try to setup CI/CD with Jenkins for our project. The project itself has Elasticsearch and PostgreSQL as runtime dependencies and Webdriver for acceptance testing.
In dev environment, everything is set up within one `docker-compose.yml` file and we have `acceptance.sh` script to run acceptance tests.

After digging documentation I found that it's potentially possible to build CI with following steps:

1. dockerize project 
2. pull project from git repo
3. somehow pull `docker-compose.yml` and project `Dockerfile` - either:
 * put it in the project repo
 * put it in separate repo (this is how it's done now)
 * put somewhere on a  server and jut copy it over
4. execute `docker-compose up`
5. project's Dockerfile will have `ONBUILT` section to run tests. Unit tests are run through `mix tests` and acceptance through `scripts/acceptance.sh`. It'll be cool to run them in parallel. 
6. shutdown `docker-compose`, clean up containers

Because this is my first experience with Jenkins a series of questions arise:

- Is this a viable strategy? 
- How to connect tests output with Jenkins?
- How to run and shut down docker-compose? 
- Do we need/want to write a pipeline for that? Will we need/want pipeline when we will get to the CD on the next stage? 

Thanks

Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden