elasticsearch 7x 因为 gitlab 服务不允许在变量名中使用点
elasticsearch 7x as gitlab service doesn't allow dot in variable name
我正在尝试在我的 gitlab 管道中 运行 elasticsearch 7.0.1,这里是配置片段:
test:
stage: test
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
alias: elastic
variables:
cluster.initial_master_nodes: elastic
node.name: elastic
但是当我 运行 它时,我收到以下错误消息:
/bin/bash: line 82: export: `cluster.initial_master_nodes=elastic': not a valid identifier
Gitlab 似乎使用 bash 导出变量,但 bash 不允许在名称中使用点。我尝试用双下划线转义但没有用。有什么建议吗?
带点的变量名在 sh 中无效,确实 bash。
official documentation有一个解决方案(适用于 7.15 版本):
Change the setting name to uppercase
Prefix it with ES_SETTING_
Escape any underscores (_) by duplicating them
Convert all periods (.) to underscores (_)
试试变量名(注意双下划线):
ES_SETTING_CLUSTER_INITIAL__MASTER__NODES: elastic
ES_SETTING_NODE_NAME: elastic
我正在尝试在我的 gitlab 管道中 运行 elasticsearch 7.0.1,这里是配置片段:
test:
stage: test
services:
- name: docker.elastic.co/elasticsearch/elasticsearch:7.0.1
alias: elastic
variables:
cluster.initial_master_nodes: elastic
node.name: elastic
但是当我 运行 它时,我收到以下错误消息:
/bin/bash: line 82: export: `cluster.initial_master_nodes=elastic': not a valid identifier
Gitlab 似乎使用 bash 导出变量,但 bash 不允许在名称中使用点。我尝试用双下划线转义但没有用。有什么建议吗?
带点的变量名在 sh 中无效,确实 bash。
official documentation有一个解决方案(适用于 7.15 版本):
Change the setting name to uppercase
Prefix it with ES_SETTING_
Escape any underscores (_) by duplicating them
Convert all periods (.) to underscores (_)
试试变量名(注意双下划线):
ES_SETTING_CLUSTER_INITIAL__MASTER__NODES: elastic
ES_SETTING_NODE_NAME: elastic