I have a .gitlab-ci.yml
file:
integration_test:
services:
- name: registry.gitlab.com/group/project/testmailserver:1.1
alias: "mail.email"
stage: test
script:
- ./gradlew -g /cache/.gradle --stacktrace --info integrationTest
The service is a full stack email server based on this: tvial/docker-mailserver:latest
. Locally with my docker-compose
config I'm able to run it and connect to it.
version: '2'
services:
mail:
image: registry.gitlab.com/group/project/testmailserver:1.1
hostname: mail
domainname: localhost
ports:
- "25:25"
- "143:143"
- "587:587"
- "993:993"
environment:
- ONE_DIR=1
- DMS_DEBUG=0
- MAIL_USER=invoicereader
- MAIL_PASS=invoicereader
cap_add:
- NET_ADMIN
If I run it with docker-compose up
and connect to it via IMAP on port 993 it works fine. Also the integration test runs smoothly
However, if the integration test is executed by gitlab CI, it fails. The only exception I could get is Connection refused.
Can it be that the ports of the service are not exposed properly? How does the CI server determine the ports it has to open to said service?
What might be the problem when running with CI? How can I test it differently?
Sorry for the lot of questions, I'm just hopelessly lost..
gitlab-runner
, and execute your job locally withgitlab-runner exec docker jobname
to test it. To debug or play around with it, insert the following line just before the part where it fails:tail -F /dev/null
. This will cause the execution of the job to hang for 30 minutes. While it hangs, attach to the container withdocker exec -ti container_name /bin/bash
. Hope this helps. – Protectorate