8
8
test-command :
9
9
required : true
10
10
type : string
11
+ osd-serve-args :
12
+ required : false
13
+ type : string
14
+ security-enabled :
15
+ required : false
16
+ type : string
11
17
jobs :
12
18
tests :
13
19
name : Run Cypress E2E tests for ${{ inputs.test-name }}
@@ -31,21 +37,39 @@ jobs:
31
37
working-directory : cypress-test
32
38
run : |
33
39
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
40
+ - name : Get security setups
41
+ run : |
42
+ SECURITY_ENABLED=${{ inputs.security-enabled }}
43
+ if [ "$SECURITY_ENABLED" != 'false' ]; then
44
+ echo "SECURITY_ENABLED=true" >> $GITHUB_ENV
45
+ else
46
+ echo "SECURITY_ENABLED=false" >> $GITHUB_ENV
47
+ fi
34
48
- name : Get and run OpenSearch
35
49
run : |
36
50
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
37
51
tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz
38
52
cd opensearch-${{ env.VERSION }}/
39
- ./opensearch-tar-install.sh &
40
- timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
53
+ if [ "$SECURITY_ENABLED" = 'false' ]; then
54
+ echo "Remove OpenSearch Security"
55
+ [ -d "plugins/opensearch-security" ] && echo "plugins.security.disabled: true" >> config/opensearch.yml
56
+ ./opensearch-tar-install.sh &
57
+ timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' http://localhost:9200)" != "200" ]]; do sleep 5; done'
58
+ curl http://localhost:9200
59
+ else
60
+ echo "Keep OpenSearch Security"
61
+ ./opensearch-tar-install.sh &
62
+ timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
63
+ curl https://localhost:9200 -u admin:admin --insecure
64
+ fi
41
65
- name : Get OpenSearch-Dashboards
42
66
run : |
43
67
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
44
68
tar -xzf opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
45
69
- name : Get node and yarn versions
46
70
id : versions
47
71
run : |
48
- echo "::set-output name=node_version::$(node -p "(require('./opensearch-dashboards-${{ env.VERSION }}-linux-x64 /package.json').engines.node).match(/[.0-9]+/)[0]")"
72
+ echo "::set-output name=node_version::$(node -p "(require('./opensearch-dashboards-${{ env.VERSION }}/package.json').engines.node).match(/[.0-9]+/)[0]")"
49
73
- name : Setup node
50
74
uses : actions/setup-node@v1
51
75
with :
54
78
- name : Run OpenSearch-Dashboards server
55
79
run : |
56
80
cd opensearch-dashboards-${{ env.VERSION }}
57
- bin/opensearch-dashboards serve &
58
- timeout 300 bash -c 'while [[ "$(curl -s -u admin:admin -k localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
81
+ if [ "$SECURITY_ENABLED" = 'false' ]; then
82
+ echo "Remove Dashboards Security"
83
+ ./bin/opensearch-dashboards-plugin remove securityDashboards
84
+ sed -i /^opensearch_security/d config/opensearch_dashboards.yml
85
+ sed -i 's/https/http/' config/opensearch_dashboards.yml
86
+ bin/opensearch-dashboards serve ${{ inputs.osd-serve-args }} &
87
+ timeout 300 bash -c 'while [[ "$(curl http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
88
+ curl http://localhost:5601/api/status
89
+ else
90
+ echo "Keep Dashboards Security"
91
+ bin/opensearch-dashboards serve ${{ inputs.osd-serve-args }} &
92
+ timeout 300 bash -c 'while [[ "$(curl -u admin:admin -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
93
+ curl http://localhost:5601/api/status -u admin:admin --insecure
94
+ fi
59
95
- name : Get Cypress version
60
96
id : cypress_version
61
97
run : |
93
129
if : always()
94
130
with :
95
131
name : cypress-results
96
- path : cypress-test/cypress/results
132
+ path : cypress-test/cypress/results
0 commit comments