@@ -2,10 +2,99 @@ name: E2E tests workflow
2
2
on :
3
3
push :
4
4
branches :
5
- - master
5
+ - securityCI
6
+ env :
7
+ KIBANA_VERSION : 7.8.0
8
+ ODFE_VERSION : 1.9.0
6
9
jobs :
7
- tests :
8
- name : Run e2e tests
10
+ test-with-security :
11
+ name : Run e2e tests with security
12
+ strategy :
13
+ matrix :
14
+ os : [ubuntu-16.04] # use ubuntu-16.04 as required by cypress: https://github.com/marketplace/actions/cypress-io#important
15
+ java : [14]
16
+ runs-on : ${{ matrix.os }}
17
+ steps :
18
+ - name : Checkout Kibana
19
+ uses : actions/checkout@v2
20
+ with :
21
+ repository : opendistro-for-elasticsearch/kibana-oss
22
+ ref : ${{ env.KIBANA_VERSION }}
23
+ token : ${{ secrets.KIBANA_OSS_ACCESS }}
24
+ path : kibana
25
+
26
+ - name : Get node and yarn versions
27
+ id : versions_step
28
+ run : |
29
+ echo "::set-output name=node_version::$(node -p "(require('./kibana/package.json').engines.node).match(/[.0-9]+/)[0]")"
30
+ echo "::set-output name=yarn_version::$(node -p "(require('./kibana/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
31
+
32
+ - name : Setup node
33
+ uses : actions/setup-node@v1
34
+ with :
35
+ node-version : ${{ steps.versions_step.outputs.node_version }}
36
+ registry-url : ' https://registry.npmjs.org'
37
+
38
+ - name : Install correct yarn version for Kibana
39
+ run : |
40
+ npm uninstall -g yarn
41
+ echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
42
+ npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
43
+
44
+ - name : Checkout Anomaly Detection Kibana plugin
45
+ uses : actions/checkout@v2
46
+ with :
47
+ path : kibana/plugins/anomaly-detection-kibana-plugin
48
+
49
+ - name : Bootstrap the plugin
50
+ run : |
51
+ cd kibana/plugins/anomaly-detection-kibana-plugin
52
+ yarn kbn bootstrap
53
+
54
+ - name : Build the artifact
55
+ run : |
56
+ cd kibana/plugins/anomaly-detection-kibana-plugin
57
+ yarn build
58
+
59
+ - name : Create tagged images for ES and Kibana
60
+ run : |
61
+ cd kibana/plugins/anomaly-detection-kibana-plugin
62
+ odfe_version=$ODFE_VERSION
63
+ plugin_version=$(node -pe "require('./package.json').version")
64
+ echo odfe version: $odfe_version
65
+ echo plugin version: $plugin_version
66
+ if docker pull opendistroforelasticsearch/opendistroforelasticsearch:$odfe_version
67
+ then
68
+ ## Populate the Dockerfiles
69
+ echo "FROM opendistroforelasticsearch/opendistroforelasticsearch:$odfe_version" >> Dockerfile-AD
70
+ echo "FROM opendistroforelasticsearch/opendistroforelasticsearch-kibana:$odfe_version" >> Dockerfile-AD-Kibana
71
+ echo "COPY build/opendistro-anomaly-detection-kibana-$plugin_version.zip ." >> Dockerfile-AD-Kibana
72
+ ## Uninstall existing AD artifact and install new one
73
+ echo "RUN if [ -d /usr/share/kibana/plugins/opendistro-anomaly-detection-kibana ]; then /usr/share/kibana/bin/kibana-plugin remove opendistro-anomaly-detection-kibana; fi" >> Dockerfile-AD-Kibana
74
+ echo "RUN bin/kibana-plugin install file:///usr/share/kibana/opendistro-anomaly-detection-kibana-$plugin_version.zip;" >> Dockerfile-AD-Kibana
75
+
76
+ ## Create the tagged images
77
+ docker build -f ./Dockerfile-AD -t odfe-ad:test .
78
+ docker build -f ./Dockerfile-AD-Kibana -t odfe-ad-kibana:test .
79
+ fi
80
+ docker images
81
+
82
+ - name : Start ES and Kibana
83
+ run : |
84
+ cd kibana/plugins/anomaly-detection-kibana-plugin/.github/configurations
85
+ ## Need to increase max map count for running the docker container
86
+ sudo sysctl -w vm.max_map_count=262144
87
+ docker-compose up -d
88
+ sleep 180
89
+
90
+ - name : Run e2e tests
91
+ uses : cypress-io/github-action@v1
92
+ with :
93
+ working-directory : kibana/plugins/anomaly-detection-kibana-plugin
94
+ command : yarn cy:run --env SECURITY_ENABLED=true
95
+
96
+ test-without-security :
97
+ name : Run e2e tests without security
9
98
strategy :
10
99
matrix :
11
100
os : [ubuntu-16.04] # use ubuntu-16.04 as required by cypress: https://github.com/marketplace/actions/cypress-io#important
@@ -14,11 +103,11 @@ jobs:
14
103
steps :
15
104
- name : Pull and Run Docker
16
105
run : |
17
- version=1.9.0
18
- echo $ version
19
- if docker pull opendistroforelasticsearch/opendistroforelasticsearch:$version
106
+ odfe_version=$ODFE_VERSION
107
+ echo odfe version: $odfe_version
108
+ if docker pull opendistroforelasticsearch/opendistroforelasticsearch:$odfe_version
20
109
then
21
- echo "FROM opendistroforelasticsearch/opendistroforelasticsearch:$version " >> Dockerfile
110
+ echo "FROM opendistroforelasticsearch/opendistroforelasticsearch:$odfe_version " >> Dockerfile
22
111
## The ESRestTest Client uses http by default.
23
112
## Need to disable the security plugin to call the rest api over http.
24
113
echo "RUN if [ -d /usr/share/elasticsearch/plugins/opendistro_security ]; then /usr/share/elasticsearch/bin/elasticsearch-plugin remove opendistro_security; fi" >> Dockerfile
@@ -29,12 +118,11 @@ jobs:
29
118
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" odfe-ad:test
30
119
sleep 90
31
120
curl -XGET http://localhost:9200/_cat/plugins
32
-
33
121
- name : Checkout Kibana
34
122
uses : actions/checkout@v2
35
123
with :
36
124
repository : opendistro-for-elasticsearch/kibana-oss
37
- ref : 7.8.0
125
+ ref : ${{ env.KIBANA_VERSION }}
38
126
token : ${{ secrets.KIBANA_OSS_ACCESS }}
39
127
path : kibana
40
128
- name : Get node and yarn versions
0 commit comments