I'm trying to run elasticsearch 7.0.1 in my gitlab pipeline, here is configuration snippet:
test:
stage: test
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
alias: elastic
variables:
cluster.initial_master_nodes: elastic
node.name: elastic
But when I run it I get following error message:
/bin/bash: line 82: export: `cluster.initial_master_nodes=elastic': not a valid identifier
It seems that Gitlab uses bash to export variables but bash doesn't allow dots in names. I tried escaping with double underscore but didn't work. Any suggestions?
CodePudding user response:
Variable names with a dot are not valid in sh and bash indeed.
The official documentation has a solution:
Change the setting name to uppercase
Prefix it with ES_SETTING_
Escape any underscores (_) by duplicating them
Convert all periods (.) to underscores (_)
Try variable names (pay attention to double underscores):
ES_SETTING_CLUSTER_INITIAL__MASTER__NODES: elastic
ES_SETTING_NODE_NAME: elastic