I'm using gitlab and it's ci/cd system to build, test and deploy my code. I've set it up so my builds and my tests are in separate containers:
image: docker:latest
...
callback_build:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --no-cache -t $CI_REGISTRY_IMAGE:$CI_PIPELINE_ID .
- docker push $CI_REGISTRY_IMAGE:$CI_PIPELINE_ID
callback_test:
stage: test
image: tmaier/docker-compose:latest
script:
- cd test/
- >
docker-compose -f docker-compose.yml up
--build
--abort-on-container-exit
--exit-code-from hellosign-callback-listener-tests
Within my Dockerfile for the tests I run the command: ENTRYPOINT [ "mocha", "--config", "./test/.mocharc.js"]
Now because of the way we have things setup, the output from docker is not displayed in the gitlab ci/cd view, instead I think it's forwarded to logstash which then pushes it to our ELK stack so it can be viewed on Kibana. At the moment this isn't reliable, so I thought the best way would be to use gitlabs artifacts.
Gitlab doesn't seem to have a custom mochajs artifact integration, so I'm unsure how best to get the output from mocha into an artifact for me to download from gitlab and view.