Skip to content

Commit 1f316e4

Browse files
authored
Merge branch 'opensearch-project:main' into main
2 parents 752e096 + a32b669 commit 1f316e4

31 files changed

+514
-259
lines changed

.github/CODEOWNERS

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @bowenlan-amzn @Hailong-am @RamakrishnaChilaka @vikasvb90 @SuZhou-Joe
1+
* @bowenlan-amzn @Hailong-am @RamakrishnaChilaka @vikasvb90 @SuZhou-Joe @tandonks @shiv0408 @soosinha
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: 'Runs the cypress test suite'
2+
description: 'Re-usable workflow to run cypress tests against a cluster with or without security'
3+
4+
inputs:
5+
with-security:
6+
description: 'Whether security should be installed on the cluster the tests are run with'
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Set up JDK
13+
uses: actions/setup-java@v1
14+
with:
15+
# TODO: Parse this from index management plugin
16+
java-version: 21
17+
- name: Checkout index management
18+
uses: actions/checkout@v2
19+
with:
20+
path: index-management
21+
repository: opensearch-project/index-management
22+
ref: 'main'
23+
- name: Run opensearch with plugin
24+
shell: bash
25+
if: ${{ inputs.with-security == 'false' }}
26+
run: |
27+
cd index-management
28+
./gradlew run &
29+
sleep 300
30+
# timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done'
31+
- name: Run opensearch with plugin
32+
shell: bash
33+
if: ${{ inputs.with-security == 'true' }}
34+
run: |
35+
cd index-management
36+
./gradlew run -Dsecurity=true -Dhttps=true &
37+
sleep 300
38+
# timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done'
39+
- name: Checkout Index Management Dashboards plugin
40+
uses: actions/checkout@v2
41+
with:
42+
path: index-management-dashboards-plugin
43+
- name: Checkout Security Dashboards plugin
44+
uses: actions/checkout@v2
45+
with:
46+
repository: opensearch-project/security-dashboards-plugin
47+
path: security-dashboards-plugin
48+
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
49+
- name: Checkout OpenSearch-Dashboards
50+
uses: actions/checkout@v2
51+
with:
52+
repository: opensearch-project/OpenSearch-Dashboards
53+
path: OpenSearch-Dashboards
54+
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
55+
- name: Setup Node
56+
uses: actions/setup-node@v3
57+
with:
58+
node-version-file: './OpenSearch-Dashboards/.nvmrc'
59+
registry-url: 'https://registry.npmjs.org'
60+
- name: Install Yarn
61+
# Need to use bash to avoid having a windows/linux specific step
62+
shell: bash
63+
run: |
64+
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
65+
echo "Installing yarn@$YARN_VERSION"
66+
npm i -g yarn@$YARN_VERSION
67+
- run: node -v
68+
shell: bash
69+
- run: yarn -v
70+
shell: bash
71+
- name: Configure OpenSearch Dashboards for cypress
72+
shell: bash
73+
if: ${{ inputs.with-security == 'true' }}
74+
run: |
75+
cat << 'EOT' > ./OpenSearch-Dashboards/config/opensearch_dashboards.yml
76+
server.host: "0.0.0.0"
77+
opensearch.hosts: ["https://localhost:9200"]
78+
opensearch.ssl.verificationMode: none
79+
opensearch.username: "kibanaserver"
80+
opensearch.password: "kibanaserver"
81+
opensearch.requestHeadersWhitelist: [ authorization,securitytenant ]
82+
opensearch_security.multitenancy.enabled: true
83+
opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"]
84+
opensearch_security.readonly_mode.roles: ["kibana_read_only"]
85+
opensearch_security.cookie.secure: false
86+
EOT
87+
- name: Print Dashboards Config
88+
shell: bash
89+
if: ${{ inputs.with-security == 'true' }}
90+
run: |
91+
cat ./OpenSearch-Dashboards/config/opensearch_dashboards.yml
92+
- name: Bootstrap plugin/OpenSearch-Dashboards
93+
shell: bash
94+
if: ${{ inputs.with-security == 'false' }}
95+
run: |
96+
mkdir -p OpenSearch-Dashboards/plugins
97+
mv index-management-dashboards-plugin OpenSearch-Dashboards/plugins
98+
- name: Bootstrap plugin/OpenSearch-Dashboards
99+
shell: bash
100+
if: ${{ inputs.with-security == 'true' }}
101+
run: |
102+
mkdir -p OpenSearch-Dashboards/plugins
103+
mv index-management-dashboards-plugin OpenSearch-Dashboards/plugins
104+
mv security-dashboards-plugin OpenSearch-Dashboards/plugins
105+
- name: Bootstrap the OpenSearch Dashboard
106+
uses: nick-fields/retry@v2
107+
with:
108+
timeout_minutes: 20
109+
max_attempts: 2
110+
command: yarn --cwd OpenSearch-Dashboards osd bootstrap --oss --single-version=loose
111+
- name: Compile OpenSearch Dashboards
112+
shell: bash
113+
run: |
114+
cd OpenSearch-Dashboards
115+
node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers=10 --verbose
116+
- name: Run OpenSearch-Dashboards server
117+
shell: bash
118+
run: |
119+
cd OpenSearch-Dashboards
120+
yarn start --no-base-path --no-watch --server.host="0.0.0.0" &
121+
sleep 30
122+
# in main branch, OSD server requires more time to bundle and bootstrap
123+
# timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
124+
# for now just chrome, use matrix to do all browsers later
125+
- name: Cypress tests
126+
uses: cypress-io/github-action@v2
127+
if: ${{ inputs.with-security == 'false' }}
128+
with:
129+
working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
130+
command: yarn run cypress run
131+
wait-on: 'http://localhost:5601'
132+
browser: chrome
133+
- name: Cypress tests
134+
uses: cypress-io/github-action@v2
135+
if: ${{ inputs.with-security == 'true' }}
136+
with:
137+
working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
138+
command: yarn run cypress run --env SECURITY_ENABLED=true,openSearchUrl=https://localhost:9200,WAIT_FOR_LOADER_BUFFER_MS=500
139+
wait-on: 'http://localhost:5601'
140+
browser: chrome
141+
# Screenshots are only captured on failure, will change this once we do visual regression tests
142+
- uses: actions/upload-artifact@v3
143+
if: failure()
144+
with:
145+
name: cypress-screenshots
146+
path: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin/cypress/screenshots
147+
# Test run video was always captured, so this action uses "always()" condition
148+
- uses: actions/upload-artifact@v3
149+
if: always()
150+
with:
151+
name: cypress-videos
152+
path: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin/cypress/videos
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: E2E tests workflow
2+
on:
3+
pull_request:
4+
branches:
5+
- "*"
6+
push:
7+
branches:
8+
- "*"
9+
env:
10+
OPENSEARCH_DASHBOARDS_VERSION: 'main'
11+
jobs:
12+
tests:
13+
name: Run Cypress E2E tests with security
14+
runs-on: ubuntu-latest
15+
env:
16+
# prevents extra Cypress installation progress messages
17+
CI: 1
18+
# avoid warnings like "tput: No value for $TERM and no -T specified"
19+
TERM: xterm
20+
steps:
21+
- name: Checkout Branch
22+
uses: actions/checkout@v3
23+
- id: run-cypress-tests
24+
uses: ./.github/actions/run-cypress-tests
25+
with:
26+
with-security: true

.github/workflows/cypress-workflow.yml

+5-74
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ on:
88
- "*"
99
env:
1010
OPENSEARCH_DASHBOARDS_VERSION: 'main'
11-
OPENSEARCH_VERSION: '3.0.0-SNAPSHOT'
1211
jobs:
1312
tests:
1413
name: Run Cypress E2E tests
@@ -19,77 +18,9 @@ jobs:
1918
# avoid warnings like "tput: No value for $TERM and no -T specified"
2019
TERM: xterm
2120
steps:
22-
- name: Set up JDK
23-
uses: actions/setup-java@v1
21+
- name: Checkout Branch
22+
uses: actions/checkout@v3
23+
- id: run-cypress-tests
24+
uses: ./.github/actions/run-cypress-tests
2425
with:
25-
# TODO: Parse this from index management plugin
26-
java-version: 11
27-
- name: Checkout index management
28-
uses: actions/checkout@v2
29-
with:
30-
path: index-management
31-
repository: opensearch-project/index-management
32-
ref: 'main'
33-
- name: Run opensearch with plugin
34-
run: |
35-
cd index-management
36-
./gradlew run -Dopensearch.version=${{ env.OPENSEARCH_VERSION }} &
37-
sleep 300
38-
# timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done'
39-
- name: Checkout Index Management Dashboards plugin
40-
uses: actions/checkout@v2
41-
with:
42-
path: index-management-dashboards-plugin
43-
- name: Checkout OpenSearch-Dashboards
44-
uses: actions/checkout@v2
45-
with:
46-
repository: opensearch-project/OpenSearch-Dashboards
47-
path: OpenSearch-Dashboards
48-
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
49-
- name: Setup Node
50-
uses: actions/setup-node@v3
51-
with:
52-
node-version-file: './OpenSearch-Dashboards/.nvmrc'
53-
registry-url: 'https://registry.npmjs.org'
54-
- name: Install Yarn
55-
# Need to use bash to avoid having a windows/linux specific step
56-
shell: bash
57-
run: |
58-
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn")
59-
echo "Installing yarn@$YARN_VERSION"
60-
npm i -g yarn@$YARN_VERSION
61-
- run: node -v
62-
- run: yarn -v
63-
- name: Bootstrap plugin/OpenSearch-Dashboards
64-
run: |
65-
mkdir -p OpenSearch-Dashboards/plugins
66-
mv index-management-dashboards-plugin OpenSearch-Dashboards/plugins
67-
cd OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
68-
yarn osd bootstrap
69-
- name: Run OpenSearch-Dashboards server
70-
run: |
71-
cd OpenSearch-Dashboards
72-
yarn start --no-base-path --no-watch --server.host="0.0.0.0" &
73-
sleep 420
74-
# in main branch, OSD server requires more time to bundle and bootstrap
75-
# timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
76-
# for now just chrome, use matrix to do all browsers later
77-
- name: Cypress tests
78-
uses: cypress-io/github-action@v2
79-
with:
80-
working-directory: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin
81-
command: yarn run cypress run
82-
wait-on: 'http://localhost:5601'
83-
browser: chrome
84-
# Screenshots are only captured on failure, will change this once we do visual regression tests
85-
- uses: actions/upload-artifact@v3
86-
if: failure()
87-
with:
88-
name: cypress-screenshots
89-
path: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin/cypress/screenshots
90-
# Test run video was always captured, so this action uses "always()" condition
91-
- uses: actions/upload-artifact@v3
92-
if: always()
93-
with:
94-
name: cypress-videos
95-
path: OpenSearch-Dashboards/plugins/index-management-dashboards-plugin/cypress/videos
26+
with-security: false

MAINTAINERS.md

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ This document contains a list of maintainers in this repo. See [opensearch-proje
1111
| Ramakrishna Chilaka | [RamakrishnaChilaka](https://github.com/RamakrishnaChilaka) | Amazon |
1212
| Vikas Bansal | [vikasvb90](https://github.com/vikasvb90) | Amazon |
1313
| Zhou Su | [SuZhou-Joe](https://github.com/SuZhou-Joe) | Amazon |
14+
| Kshitij Tandon | [tandonks](https://github.com/tandonks) | Amazon |
15+
| Shivansh Arora | [shiv0408](https://github.com/shiv0408) | Amazon |
16+
| Sooraj Sinha | [soosinha](https://github.com/soosinha) | Amazon |
1417

1518
## Emeritus
1619

cypress.json

+47-13
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,48 @@
11
{
2-
"defaultCommandTimeout": 60000,
3-
"requestTimeout": 60000,
4-
"responseTimeout": 60000,
5-
"baseUrl": "http://localhost:5601",
6-
"viewportWidth": 2000,
7-
"viewportHeight": 1320,
8-
"env": {
9-
"openSearchUrl": "http://localhost:9200",
10-
"SECURITY_ENABLED": false,
11-
"username": "admin",
12-
"password": "admin"
13-
}
14-
}
2+
"defaultCommandTimeout": 60000,
3+
"requestTimeout": 60000,
4+
"responseTimeout": 60000,
5+
"baseUrl": "http://localhost:5601",
6+
"viewportWidth": 2000,
7+
"viewportHeight": 1320,
8+
"env":
9+
{
10+
"openSearchUrl": "http://localhost:9200",
11+
"SECURITY_ENABLED": false,
12+
"username": "admin",
13+
"password": "admin"
14+
},
15+
"clientCertificates":
16+
[
17+
{
18+
"url": "https://localhost:9200/.opendistro-ism*",
19+
"ca":
20+
[
21+
"cypress/resources/root-ca.pem"
22+
],
23+
"certs":
24+
[
25+
{
26+
"cert": "cypress/resources/kirk.pem",
27+
"key": "cypress/resources/kirk-key.pem",
28+
"passphrase": ""
29+
}
30+
]
31+
},
32+
{
33+
"url": "https://localhost:9200/.opendistro-ism-config/_update_by_query/",
34+
"ca":
35+
[
36+
"cypress/resources/root-ca.pem"
37+
],
38+
"certs":
39+
[
40+
{
41+
"cert": "cypress/resources/kirk.pem",
42+
"key": "cypress/resources/kirk-key.pem",
43+
"passphrase": ""
44+
}
45+
]
46+
}
47+
]
48+
}

cypress/plugins/index.js

-12
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@
2323
/**
2424
* @type {Cypress.PluginConfig}
2525
*/
26-
27-
const fs = require("fs");
28-
const path = require("path");
29-
3026
module.exports = (on) => {
3127
// const options = {
3228
// webpackOptions: {
@@ -46,12 +42,4 @@ module.exports = (on) => {
4642
// };
4743
//
4844
// on("file:preprocessor", wp(options));
49-
on("task", {
50-
readCertAndKey() {
51-
const cert = fs.readFileSync(path.resolve(__dirname, "../resources/kirk.pem"));
52-
const key = fs.readFileSync(path.resolve(__dirname, "../resources/kirk-key.pem"));
53-
54-
return { cert, key };
55-
},
56-
});
5745
};

cypress/resources/kirk-key.pem

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ nBY2S57MSM11/MVslrEgGmYNnI4r1K25xlaqV6K6ztEJv6n69327MS4NG8L/gCU5
2525
mQGwy8vIqMjAdHGLrCS35sVYBXG13knS52LJHvbVee39AbD5/LlWvjJGlQMzCLrw
2626
F7oILW5kXxhb8S73GWcuMbuQMFVHFONbZAZgn+C9FW4l7XyRdkrbR1MRZ2km8YMs
2727
/AHmo368d4PSNRMMzLHw8Q==
28-
-----END PRIVATE KEY-----
28+
-----END PRIVATE KEY-----

0 commit comments

Comments
 (0)