Skip to content

GitLab CI: Cannot use Elasticsearch service

Starting with Elasticsearch 5.4 the Docker image provided by Elasticsearch requires to run using the environment setting discovery.type=single-node as described here: https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-dev-mode Another solution to this is to increase the vm.max_map_count of sysctl, as described in this GitLab infrastructure issue: https://gitlab.com/gitlab-com/infrastructure/issues/1687

Since for some of us it is not possible to change vm.max_map_count we're "stuck" with the discovery.type=single-node setting. I tried using this in my .gitlab-ci.yml as follows:

services:
  - docker.elastic.co/elasticsearch/elasticsearch-oss:6.1.2
variables:
  "discovery.type": "single-node"

Produces the following build error: /bin/bash: line 47: export: discovery.type=single-node': not a valid identifier`

services:
  - docker.elastic.co/elasticsearch/elasticsearch-oss:6.1.2
variables:
  - "discovery.type=single-node"

Produces the following YAML error: variables config should be a hash of key value pairs

Is there any way this could be solved?

Thanks in advance!