3030 required : false
3131 type : number
3232
33+ concurrency :
34+ group : ${{ github.workflow }}-${{ github.ref }}
35+ cancel-in-progress : true
36+
3337env :
3438 TEST_REPO : ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }}
3539 TEST_BRANCH : " ${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}"
5559 LATEST_VERSION : ' 3.4.0'
5660
5761jobs :
62+ prep-dashboards :
63+ runs-on : ubuntu-latest
64+ container :
65+ image : docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
66+ options : ' --user 1001'
67+ steps :
68+ - name : Get source information from PR number
69+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.pr_number != '' }}
70+ id : get_pr_info
71+ uses : actions/github-script@v6
72+ with :
73+ script : |
74+ const { data: result } = await github.rest.pulls.get({
75+ owner: context.repo.owner,
76+ repo: context.repo.repo,
77+ pull_number: ${{ inputs.pr_number }}
78+ });
79+ core.setOutput('head_name', result.head.repo.full_name);
80+ core.setOutput('head_ref', result.head.ref);
81+
82+ - name : Set source repo from PR number
83+ if : ${{ github.event_name == 'workflow_dispatch' && inputs.pr_number != '' }}
84+ run : |
85+ echo "SOURCE_REPO=${{ steps.get_pr_info.outputs.head_name }}" >> $GITHUB_ENV
86+ echo "SOURCE_BRANCH=${{ steps.get_pr_info.outputs.head_ref }}" >> $GITHUB_ENV
87+
88+ - name : Checkout code
89+ uses : actions/checkout@v4
90+ with :
91+ repository : ${{ env.SOURCE_REPO }}
92+ ref : ' ${{ env.SOURCE_BRANCH }}'
93+
94+ - name : Setup Node
95+ uses : actions/setup-node@v4
96+ with :
97+ node-version-file : ' .nvmrc'
98+ registry-url : ' https://registry.npmjs.org'
99+
100+ - name : Setup Yarn (after Node is available)
101+ run : |
102+ npm uninstall -g yarn || true
103+ npm i -g yarn@^1.22.10
104+ yarn config set network-timeout 1000000 -g
105+
106+ - name : Cache yarn packages
107+ uses : actions/cache@v4
108+ with :
109+ path : |
110+ ~/.cache/yarn
111+ node_modules
112+ */*/node_modules
113+ key : ${{ runner.os }}-yarn-${{ github.run_id }}-${{ hashFiles('**/yarn.lock') }}
114+ restore-keys : |
115+ ${{ runner.os }}-yarn-${{ github.run_id }}-
116+
117+ - name : Run bootstrap
118+ run : yarn osd bootstrap
119+
120+ - name : Cache built plugins
121+ uses : actions/cache@v4
122+ with :
123+ path : |
124+ target
125+ src/core/target
126+ src/plugins/*/target
127+ packages/*/target
128+ key : ${{ runner.os }}-built-plugins-${{ github.run_id }}-${{ github.sha }}
129+ restore-keys : |
130+ ${{ runner.os }}-built-plugins-${{ github.run_id }}-
131+
132+ - name : Build plugins
133+ run : node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 12
134+
135+ - name : Compress build artifacts
136+ run : |
137+ tar -cf dashboards-build-artifacts.tar \
138+ target/ \
139+ node_modules/ \
140+ src/core/target/ \
141+ src/plugins/*/target/ \
142+ packages/*/target/
143+ shell : bash
144+
145+ - name : Upload build artifacts
146+ uses : actions/upload-artifact@v4
147+ with :
148+ name : dashboards-build-artifacts
149+ path : dashboards-build-artifacts.tar
150+ retention-days : 1
151+
152+ prep-opensearch :
153+ runs-on : ubuntu-latest
154+ steps :
155+ - name : Cache configured OpenSearch
156+ id : cache-opensearch-configured
157+ uses : actions/cache@v4
158+ with :
159+ path : opensearch-configured.tar.gz
160+ key : opensearch-configured-${{ env.LATEST_VERSION }}-${{ github.run_id }}
161+
162+ - name : Setup Java 21
163+ if : steps.cache-opensearch-configured.outputs.cache-hit != 'true'
164+ uses : actions/setup-java@v4
165+ with :
166+ distribution : ' temurin'
167+ java-version : ' 21'
168+
169+ - name : Download OpenSearch
170+ if : steps.cache-opensearch-configured.outputs.cache-hit != 'true'
171+ uses : suisei-cn/actions-download-file@v1.4.0
172+ with :
173+ url : https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz
174+
175+ - name : Extract and configure OpenSearch
176+ if : steps.cache-opensearch-configured.outputs.cache-hit != 'true'
177+ run : |
178+ tar -xzf opensearch-*.tar.gz
179+ rm -f opensearch-*.tar.gz
180+
181+ # Remove security plugin and plugins that depend on security
182+ /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-skills" || true
183+ /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-ml" || true
184+ /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-anomaly-detection" || true
185+ /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-flow-framework" || true
186+ /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-security" || true
187+
188+ # Configure OpenSearch for index creation
189+ echo "action.auto_create_index: true" >> ./opensearch-${{ env.LATEST_VERSION }}/config/opensearch.yml
190+ echo "cluster.routing.allocation.disk.threshold_enabled: false" >> ./opensearch-${{ env.LATEST_VERSION }}/config/opensearch.yml
191+
192+ # Compress configured OpenSearch
193+ tar -czf opensearch-configured.tar.gz opensearch-${{ env.LATEST_VERSION }}/
194+ shell : bash
195+
196+ - name : Upload configured OpenSearch
197+ uses : actions/upload-artifact@v4
198+ with :
199+ name : opensearch-configured
200+ path : opensearch-configured.tar.gz
201+ retention-days : 1
202+
58203 cypress-tests :
204+ needs : [prep-dashboards, prep-opensearch]
59205 runs-on : ubuntu-latest
60206 strategy :
61207 fail-fast : false
@@ -199,17 +345,37 @@ jobs:
199345 node-version-file : ' .nvmrc'
200346 registry-url : ' https://registry.npmjs.org'
201347
202- - name : Setup Yarn
348+ - name : Setup Yarn (after Node is available)
203349 run : |
204- npm uninstall -g yarn
350+ npm uninstall -g yarn || true
205351 npm i -g yarn@^1.22.10
206352 yarn config set network-timeout 1000000 -g
207353
208- - name : Run bootstrap
209- run : yarn osd bootstrap
354+ - name : Download build artifacts
355+ uses : actions/download-artifact@v4
356+ with :
357+ name : dashboards-build-artifacts
358+ path : .
210359
211- - name : Build plugins
212- run : node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 12 --dist
360+ - name : Extract build artifacts
361+ run : |
362+ tar -xf dashboards-build-artifacts.tar
363+ rm dashboards-build-artifacts.tar
364+ shell : bash
365+
366+ - name : Download configured OpenSearch
367+ if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
368+ uses : actions/download-artifact@v4
369+ with :
370+ name : opensearch-configured
371+ path : .
372+
373+ - name : Extract configured OpenSearch
374+ if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
375+ run : |
376+ tar -xzf opensearch-configured.tar.gz
377+ rm opensearch-configured.tar.gz
378+ shell : bash
213379
214380 - name : Checkout FT repo
215381 if : matrix.test_location == 'ftr'
@@ -249,20 +415,24 @@ jobs:
249415 echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}"
250416
251417 - name : Get Cypress version
418+ if : matrix.test_location == 'ftr'
252419 id : cypress_version
253420 run : |
254421 echo "cypress_version=$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" >> $GITHUB_OUTPUT
255422
256423 - name : Cache Cypress
424+ if : matrix.test_location == 'ftr'
257425 id : cache-cypress
258426 uses : actions/cache@v4
259427 with :
260428 path : ~/.cache/Cypress
261- key : cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
429+ key : cypress-cache-v2-${{ runner.os }}-${{ github.run_id }}-${{ hashFiles('**/package.json') }}
262430 env :
263431 CYPRESS_INSTALL_BINARY : ${{ steps.cypress_version.outputs.cypress_version }}
264- - run : npx cypress cache list
265- - run : npx cypress cache path
432+ - if : matrix.test_location == 'ftr'
433+ run : npx cypress cache list
434+ - if : matrix.test_location == 'ftr'
435+ run : npx cypress cache path
266436
267437 # Run tests based on configuration
268438 - name : Run FT repo tests
@@ -274,35 +444,6 @@ jobs:
274444 wait-on : ' http://localhost:9200, http://localhost:5601'
275445 command : yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}
276446
277- - name : Download OpenSearch
278- if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
279- uses : suisei-cn/actions-download-file@v1.4.0
280- with :
281- url : https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz
282-
283- - name : Extract OpenSearch
284- if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
285- run : |
286- tar -xzf opensearch-*.tar.gz
287- rm -f opensearch-*.tar.gz
288- shell : bash
289-
290- - name : Remove security plugin and plugins that depend on security
291- if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
292- run : |
293- /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-skills"
294- /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-ml"
295- /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-anomaly-detection"
296- /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-flow-framework"
297- /bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-security"
298- shell : bash
299-
300- - name : Configure OpenSearch for index creation
301- if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
302- run : |
303- echo "action.auto_create_index: true" >> ./opensearch-${{ env.LATEST_VERSION }}/config/opensearch.yml
304- echo "cluster.routing.allocation.disk.threshold_enabled: false" >> ./opensearch-${{ env.LATEST_VERSION }}/config/opensearch.yml
305- shell : bash
306447
307448 - name : Run OpenSearch
308449 if : matrix.config == 'query_enhanced' || matrix.config == 'explore'
@@ -337,17 +478,13 @@ jobs:
337478 done
338479 shell : bash
339480
340- # Clear Cypress Cache before running OSD tests
341- - name : Clear Cypress Cache
342- if : matrix.test_location == 'source'
343- run : npx cypress cache clear
344481
345482 # Run OSD Cypress tests within the source repo
346483 - name : Run OSD Cypress tests with query enhancements
347484 if : matrix.test_location == 'source' && (matrix.config == 'query_enhanced' || matrix.config == 'explore') && matrix.group != '14Explore'
348485 uses : cypress-io/github-action@v6
349486 with :
350- install-command : npx cypress install --force
487+ install-command : npx cypress install
351488 start : ${{ env.START_CMD }}
352489 wait-on : ' http://localhost:9200, http://localhost:5601'
353490 command : yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
@@ -356,7 +493,7 @@ jobs:
356493 if : matrix.test_location == 'source' && matrix.group == '14Explore'
357494 uses : cypress-io/github-action@v6
358495 with :
359- install-command : npx cypress install --force
496+ install-command : npx cypress install
360497 start : ${{ env.START_CMD }}
361498 wait-on : ' http://localhost:9200, http://localhost:5601, http://localhost:9090/-/healthy'
362499 command : yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
@@ -367,13 +504,13 @@ jobs:
367504 if : matrix.test_location == 'source' && matrix.config == 'dashboard'
368505 uses : cypress-io/github-action@v6
369506 with :
370- install-command : npx cypress install --force
507+ install-command : npx cypress install
371508 start : ${{ env.OPENSEARCH_SNAPSHOT_CMD }}, ${{ env.START_CMD }}
372509 wait-on : ' http://localhost:9200, http://localhost:5601'
373510 command : yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
374511
375512 - name : Compress FT repo artifacts
376- if : always () && matrix.test_location == 'ftr'
513+ if : failure () && matrix.test_location == 'ftr'
377514 run : |
378515 mkdir -p ftr-artifacts
379516 for dir in screenshots videos results; do
@@ -385,15 +522,15 @@ jobs:
385522 shell : bash
386523
387524 - name : Upload FT repo artifacts
388- if : always () && matrix.test_location == 'ftr'
525+ if : failure () && matrix.test_location == 'ftr'
389526 uses : actions/upload-artifact@v4
390527 with :
391528 name : ftr-cypress-artifacts-${{ matrix.group }}
392529 path : ftr-cypress-artifacts-${{ matrix.group }}.tar.gz
393530 retention-days : 1
394531
395532 - name : Compress OSD repo artifacts
396- if : always () && matrix.test_location == 'source'
533+ if : failure () && matrix.test_location == 'source'
397534 run : |
398535 mkdir -p osd-artifacts
399536 for dir in screenshots videos results; do
@@ -405,7 +542,7 @@ jobs:
405542 shell : bash
406543
407544 - name : Upload OSD repo artifacts
408- if : always () && matrix.test_location == 'source'
545+ if : failure () && matrix.test_location == 'source'
409546 uses : actions/upload-artifact@v4
410547 with :
411548 name : osd-cypress-artifacts-${{ matrix.group }}
0 commit comments