CI services communication

Hi folks,

I’m facing a bit of a strange thing here:

thejob:
  script:
    - test some stuff that calls the $SERVICE_URI
  services:
    - name: $DATABASE_IMAGE
      alias: database
    - name: $SERVICE_IMAGE
      alias: service
  variables:
    DATABASE_URI: postgres://foo:bar@database/db
    POSTGRES_DB: db
    POSTGRES_USER: foo
    POSTGRES_PASSWORD: bar
    SERVICE_URI: http://service:9296/

Basically, I’m testing a client for a http service. The http service image launches a webserver, and it requires a database.

Everything works really well in local with docker-compose, but on the CI, I get weird TimeOut errors. Those can be reproduced when the service can’t connect to the database.

Are the 2 services not able to communicate with each other? Is this a known limitation of gitlab CI? Or am I missing something?

There is now a feature flag to enable inter-service communication. Simply add the FF_NETWORK_PER_BUILD variable with a non null value to the job’s variables and they should be able to communicate now.

The reference issue.