How do I use services?

Hello all,

I had just started to tinker with GitLab CI by running some experiment using .gitlab-ci.yml. My experience with CI is smooth using shell executor since I can interact with the machine directly.

Recently, I turn to Docker executor and would like to know how to use images and services. Here is my sample .gitlab-ci.yml:

image: python:latest

services:

  • mysql:latest

stages:
-sample_build

build_job:
stage: sample_build

tags:
- docker

only:
- master
script:
- python test.py

I am using mysql as an example to understand services. My question is :

  1. How do I populate mysql database with an existing .sql file in the current branch?

  2. Let say I have another service that will be accessing mysql:latest service, how do I make this new service talk to mysql:latest?

I would very much appreciate if you can answer my doubt.

1 Like