I have trouble understanding how the gitlab-runner handles dependencies on services. I have a job that has a dependency on some service, which itself has again another dependency on a different service (e.g. a database), so I end up with the following configuration:
test: image: some_image services: - postgres - some_service #depends on postgres script: - run-test-against-some-service
How does gitlab-runner know when a service is fully started? I found something in the code that looks like a second container is started that uses netcat to check if some port opened, but how does gitlab-runner know which port to check?
Also, is it guaranteed that the services are started and waited for in the defined order? i.e., is it safe to assume that when the container for “some_service” is started, that the postgres DB is already started and available?
After some more experiments I am under the impression, that the first service (i.e., in this example the database) isn’t even linked to the second service. Is this correct?
How could something like this be implemented with GitLab CI?