-
Notifications
You must be signed in to change notification settings - Fork 120
155 lines (155 loc) · 7.49 KB
/
release-e2e-workflow-template-windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: Release tests workflow in Bundled OpenSearch Dashboards (Windows)
on:
workflow_call:
inputs:
test-name:
required: true
type: string
test-command:
required: true
type: string
security-enabled:
required: false
type: string
jobs:
tests:
name: Run Cypress E2E tests for ${{ inputs.test-name }} (Windows)
runs-on: windows-latest
env:
# prevents extra Cypress installation progress messages
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
# make Node run in ipv4 first so that cypress can detect 5601 port in CI environment
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
# 2.12 onwards security demo configuration require a custom admin password
OPENSEARCH_INITIAL_ADMIN_PASSWORD: 'myStrongPassword123!'
steps:
- name: Checkout Branch
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 21
- name: Checkout cypress-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: cypress-test
- name: Get package version
working-directory: cypress-test
run: |
echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
echo "PLATFORM=windows" >> $GITHUB_ENV
# Temp measure to resolve script not running on windows
shell: bash
- name: Get security setups
run: |
SECURITY_ENABLED=${{ inputs.security-enabled }}
if [ "$SECURITY_ENABLED" != 'false' ]; then
echo "SECURITY_ENABLED=true" >> $GITHUB_ENV
else
echo "SECURITY_ENABLED=false" >> $GITHUB_ENV
fi
shell: bash
- name: Get and run OpenSearch
run: |
curl -SLO https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/${{ env.PLATFORM }}/x64/zip/dist/opensearch/opensearch-${{ env.VERSION }}-${{ env.PLATFORM }}-x64.zip
unzip -q opensearch-${{ env.VERSION }}-windows-x64.zip
cd opensearch-${{ env.VERSION }}/
if [ "$SECURITY_ENABLED" = 'false' ]; then
echo "Remove OpenSearch Security"
[ -d "plugins/opensearch-security" ] && echo "plugins.security.disabled: true" >> config/opensearch.yml
nohup ./opensearch-windows-install.bat &
timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' http://localhost:9200)" != "200" ]]; do echo sleeping 5; sleep 5; done'
curl -s http://localhost:9200/_cluster/health?pretty
else
echo "Keep OpenSearch Security"
nohup ./opensearch-windows-install.bat &
timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do echo sleeping 5; sleep 5; done'
curl -sk https://localhost:9200/_cluster/health?pretty -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}
fi
netstat -anP tcp | grep LISTEN | grep 9200 || netstat -ntlp | grep 9200
shell: bash
- uses: ./.github/actions/start-opensearch
with:
opensearch-version: ${{ env.VERSION }}
security-enabled: false
port: 9201
- uses: ./.github/actions/start-opensearch
with:
opensearch-version: ${{ env.VERSION }}
security-enabled: true
admin-password: admin
port: 9202
- name: Get and run OpenSearch-Dashboards
run: |
curl -SLO https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/${{ env.PLATFORM }}/x64/zip/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-${{ env.PLATFORM }}-x64.zip
unzip -q opensearch-dashboards-${{ env.VERSION }}-windows-x64.zip
shell: bash
- name: Get node and yarn versions
run: |
echo "node_version=$(jq -r '.engines.node' ./opensearch-dashboards-${{ env.VERSION }}/package.json)" >> $GITHUB_ENV
shell: bash
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ env.node_version }}
registry-url: 'https://registry.npmjs.org'
- name: Run OpenSearch-Dashboards server
run: |
netstat -anP tcp | grep LISTEN | grep 9200 || netstat -ntlp | grep 9200
cd opensearch-dashboards-${{ env.VERSION }}
# Temporary solution to add vis_builder and data_source enabled parameters
echo "vis_builder.enabled: true" >> config/opensearch_dashboards.yml
echo "data_source.enabled: true" >> config/opensearch_dashboards.yml
# echo "data_source.encryption.wrappingKeyName: 'changeme'" >> config/opensearch_dashboards.yml
# echo "data_source.encryption.wrappingKeyNamespace: 'changeme'" >> config/opensearch_dashboards.yml
# echo "data_source.encryption.wrappingKey: [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]" >> config/opensearch_dashboards.yml
# Not useful now as error shows when trying to force a background run with parameters on Windows
# bin/opensearch-dashboards.bat serve ${{ inputs.osd-serve-args }} &
if [ "$SECURITY_ENABLED" = 'false' ]; then
echo "Remove Dashboards Security"
./bin/opensearch-dashboards-plugin.bat remove securityDashboards
sed -i /^opensearch_security/d config/opensearch_dashboards.yml
sed -i 's/https/http/' config/opensearch_dashboards.yml
bin/opensearch-dashboards.bat &
timeout 300 bash -c 'while [[ "$(curl http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do echo sleeping 5; sleep 5; done'
curl -s http://localhost:5601/api/status | jq
else
echo "Keep Dashboards Security"
bin/opensearch-dashboards.bat &
timeout 300 bash -c 'while [[ "$(curl -k http://localhost:5601/api/status -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} | jq -r '.status.overall.state')" != "green" ]]; do echo sleeping 5; sleep 5; done'
curl -sk localhost:5601/api/status -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} | jq
fi
netstat -anP tcp | grep LISTEN | grep 5601 || netstat -ntlp | grep 5601
shell: bash
- name: Get Cypress version
run: |
cd ./cypress-test
npm install
shell: bash
- name: Cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: cypress-test
command: ${{ inputs.test-command }}
wait-on: 'http://localhost:5601'
# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: cypress-test/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
path: cypress-test/cypress/videos
# Test reports was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-results
path: cypress-test/cypress/results