Use GitLab as a microservice
Many applications need to access JSON APIs, so application tests might need access to APIs too. The following example shows how to use GitLab as a microservice to give tests access to the GitLab API.
Configure a runner with the Docker or Kubernetes executor.
services: - name: gitlab/gitlab-ce:latest alias: gitlab variables: GITLAB_HTTPS: "false" # ensure that plain http works GITLAB_ROOT_PASSWORD: "password" # to access the api with user root:password
To set values for the
GITLAB_ROOT_PASSWORD, assign them to a variable in the user interface. Then assign that variable to the corresponding variable in your
Then, commands in
script: sections in your
.gitlab-ci.yml file can access the API at
For more information about why
gitlab is used for the
How services are linked to the job.
You can also use any other Docker image available on Docker Hub.
gitlab image can accept environment variables. For more details,
see the Omnibus documentation.