Skip to content

Commit 9b111ee

Browse files
committed
CI config (#786)
* Updated ci config * Minor fixes * Minor fixes * Added Node v11
1 parent 367f16c commit 9b111ee

File tree

5 files changed

+97
-6
lines changed

5 files changed

+97
-6
lines changed

.ci/.dockerignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

.ci/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,3 @@ COPY package*.json ./
99
RUN npm install
1010

1111
COPY . .
12-
13-
CMD [ "npm", "run", "ci" ]

.ci/run-tests

Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,101 @@
1010
# - $NODE_JS_VERSION
1111
#
1212

13+
set -eo pipefail
14+
1315
set +x
1416
export VAULT_TOKEN=$(vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
1517
export CODECOV_TOKEN=$(vault read -field=token secret/clients-ci/elasticsearch-js/codecov)
1618
unset VAULT_ROLE_ID VAULT_SECRET_ID VAULT_TOKEN
1719
set -x
1820

19-
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION} NODE_JS_VERSION=${NODE_JS_VERSION} docker-compose -f .ci/docker-compose.yml run client-oss
21+
function cleanup {
22+
docker container rm --force --volumes elasticsearch-oss > /dev/null 2>&1 || true
23+
docker container rm --force --volumes elasticsearch-platinum > /dev/null 2>&1 || true
24+
docker container rm --force --volumes elasticsearch-js-oss > /dev/null 2>&1 || true
25+
docker container rm --force --volumes elasticsearch-js-platinum > /dev/null 2>&1 || true
26+
docker network rm esnet-oss > /dev/null
27+
docker network rm esnet-platinum > /dev/null
28+
}
29+
30+
trap cleanup EXIT
31+
32+
# create network and volume
33+
docker network create esnet-oss
34+
docker network create esnet-platinum
35+
36+
# create client image
37+
docker build \
38+
--file .ci/Dockerfile \
39+
--tag elastic/elasticsearch-js \
40+
--build-arg NODE_JS_VERSION=${NODE_JS_VERSION} \
41+
.
42+
43+
# run elasticsearch oss
44+
docker run \
45+
--rm \
46+
--env "node.attr.testattr=test" \
47+
--env "path.repo=/tmp" \
48+
--env "repositories.url.allowed_urls=http://snapshot.*" \
49+
--env "discovery.type=single-node" \
50+
--network=esnet-oss \
51+
--name=elasticsearch-oss \
52+
--detach \
53+
docker.elastic.co/elasticsearch/elasticsearch-oss:${ELASTICSEARCH_VERSION}
54+
55+
# run elasticsearch platinum
56+
repo=$(pwd)
57+
testnodecrt="/.ci/certs/testnode.crt"
58+
testnodekey="/.ci/certs/testnode.key"
59+
cacrt="/.ci/certs/ca.crt"
60+
61+
docker run \
62+
--rm \
63+
--env "node.attr.testattr=test" \
64+
--env "path.repo=/tmp" \
65+
--env "repositories.url.allowed_urls=http://snapshot.*" \
66+
--env "discovery.type=single-node" \
67+
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
68+
--env "ELASTIC_PASSWORD=changeme" \
69+
--env "xpack.security.enabled=true" \
70+
--env "xpack.license.self_generated.type=trial" \
71+
--env "xpack.security.http.ssl.enabled=true" \
72+
--env "xpack.security.http.ssl.verification_mode=certificate" \
73+
--env "xpack.security.http.ssl.key=certs/testnode.key" \
74+
--env "xpack.security.http.ssl.certificate=certs/testnode.crt" \
75+
--env "xpack.security.http.ssl.certificate_authorities=certs/ca.crt" \
76+
--env "xpack.security.transport.ssl.enabled=true" \
77+
--env "xpack.security.transport.ssl.key=certs/testnode.key" \
78+
--env "xpack.security.transport.ssl.certificate=certs/testnode.crt" \
79+
--env "xpack.security.transport.ssl.certificate_authorities=certs/ca.crt" \
80+
--volume "$repo$testnodecrt:/usr/share/elasticsearch/config/certs/testnode.crt" \
81+
--volume "$repo$testnodekey:/usr/share/elasticsearch/config/certs/testnode.key" \
82+
--volume "$repo$cacrt:/usr/share/elasticsearch/config/certs/ca.crt" \
83+
--network=esnet-platinum \
84+
--name=elasticsearch-platinum \
85+
--detach \
86+
docker.elastic.co/elasticsearch/elasticsearch:${ELASTICSEARCH_VERSION}
87+
88+
# run the client unit and oss integration test
89+
docker run \
90+
--network=esnet-oss \
91+
--env "TEST_ES_SERVER=http://elasticsearch-oss:9200" \
92+
--env "CODECOV_TOKEN" \
93+
--volume $repo:/usr/src/app \
94+
--volume /usr/src/app/node_modules \
95+
--name elasticsearch-js-oss \
96+
--rm \
97+
elastic/elasticsearch-js \
98+
npm run ci
99+
100+
# run the client platinium integration test
101+
docker run \
102+
--network=esnet-platinum \
103+
--env "TEST_ES_SERVER=https://elastic:changeme@elasticsearch-platinum:9200" \
104+
--volume $repo:/usr/src/app \
105+
--volume /usr/src/app/node_modules \
106+
--name elasticsearch-js-platinum \
107+
--rm \
108+
elastic/elasticsearch-js \
109+
npm run test:integration
20110

21-
ELASTICSEARCH_VERSION=${ELASTICSEARCH_VERSION} NODE_JS_VERSION=${NODE_JS_VERSION} docker-compose -f .ci/docker-compose.yml run client-platinum

.ci/test-matrix.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ ELASTICSEARCH_VERSION:
33
- 7.0.0-beta1
44

55
NODE_JS_VERSION:
6+
- 11
67
- 10
78
- 8
89
- 6

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
npm-debug.log
3+
test/benchmarks
4+
elasticsearch
5+
.git

0 commit comments

Comments
 (0)