JoeyHolloway
JoeyHolloway

Reputation: 488

Gitlab Elasticsearch Service not connecting during pipeline run

We have managed to get both Mongo and PostgreSql working fine using Gitab service however we are facing real issues with elasticsearch.

Whenever we try to run the pipeline the connection to elastic fails.

I have tried the following steps in this thread: https://gitlab.com/gitlab-org/gitlab-ce/issues/42214 But still no luck.

i.e. both

image: maven:latest

test:
  stage: test
services:
  - name: docker.elastic.co/elasticsearch/elasticsearch:6.5.4
  alias: elasticsearch
  command: [ "bin/elasticsearch", "-Ediscovery.type=single-node" ]

  stage: test
  script:
  - ps aux
  - ss -plantu
  - curl -v "http://elasticsearch:9200/_settings?pretty"

and:

image: maven:latest

test:
  stage: test
  services:
    - elasticsearch:6.5.4
  script:
  - curl -v "http://127.0.0.1:9200/"

Result in connection errors.

Has anyone got this working for elasticsearch:6.5.4?

Upvotes: 1

Views: 1291

Answers (1)

JoeyHolloway
JoeyHolloway

Reputation: 488

This was fixed by a 15 second sleep line. ci file now looks like:

test:
  stage: test
  services:
  - name: docker.elastic.co/elasticsearch/elasticsearch:6.5.4
    command: ["bin/elasticsearch", "-Expack.security.enabled=false", "-Ediscovery.type=single-node"]
  script:
  - echo "Sleeping for 15 seconds.."; sleep 15;

Upvotes: 2

Related Questions