Skip to content

[poc] backward compat poc #7

[poc] backward compat poc

[poc] backward compat poc #7

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Backward Compatibility Test
# trigger on every commit push and PR for all branches except pushes for backport branches
on:
push:
branches: ['main', '[0-9]+\.x', '[0-9]+\.[0-9]+'] # Run the functional test on push for only release branches
paths-ignore:
- '**/*.md'
- 'docs/**'
- '.lycheeignore'
- 'CODEOWNERS'
- 'changelogs/fragments/**'
pull_request:
branches: ['**']
paths-ignore:
- '**/*.md'
- 'docs/**'
- '.lycheeignore'
- 'CODEOWNERS'
- 'changelogs/fragments/**'
env:
TEST_BROWSER_HEADLESS: 1
CI: 1
GCS_UPLOAD_PREFIX: fake
TEST_OPENSEARCH_DASHBOARDS_HOST: localhost
TEST_OPENSEARCH_DASHBOARDS_PORT: 6610
TEST_OPENSEARCH_TRANSPORT_PORT: 9403
TEST_OPENSEARCH_PORT: 9400
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
OSD_OPTIMIZER_MAX_WORKERS: 8
NODE_OPTIONS: '--max-old-space-size=8192 --max-semi-space-size=64 --dns-result-order=ipv4first'
jobs:
functional-tests:
name: Run functional tests on ${{ matrix.name }} against OpenSearch ${{ matrix.version }} (ciGroup${{ matrix.group }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
group: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
version:
[
3.3.0,
3.1.0,
2.19.0,
2.17.0,
2.15.0,
2.13.0,
2.11.0,
2.9.0,
2.7.0,
2.5.0,
2.3.0,
1.3.0,
1.2.0,
1.1.0,
1.0.0,
]
include:
- os: ubuntu-latest
name: Linux
runs-on: ${{ matrix.os }}
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001 --privileged
steps:
- run: echo Running functional tests for ciGroup${{ matrix.group }}
- name: Checkout code
uses: actions/checkout@v4
- name: Set Java version
run: |
if [[ "${{ matrix.version }}" == 1.* ]] || [[ "${{ matrix.version }}" == 2.* ]]; then
echo "JAVA_VERSION=17" >> $GITHUB_ENV
else
echo "JAVA_VERSION=21" >> $GITHUB_ENV
fi
echo "Using Java $JAVA_VERSION for OpenSearch ${{ matrix.version }}"
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g yarn@1.22.10
yarn config set network-timeout 1000000 -g
- name: Configure Yarn Cache
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV
- name: Initialize Yarn Cache
uses: actions/cache@v4
with:
path: ${{ env.YARN_CACHE_LOCATION }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Verify Chrome installation
run: |
which google-chrome || which chromium-browser || which chromium || echo "Chrome not found in PATH, but container may have it configured differently"
google-chrome --version || chromium-browser --version || chromium --version || echo "Chrome version check failed, but tests may still work"
- name: Setup chromedriver
run: node scripts/upgrade_chromedriver.js
- name: Set OpenSearch URL
run: |
echo "OPENSEARCH_URL=https://artifacts.opensearch.org/releases/core/opensearch/${{ matrix.version }}/opensearch-min-${{ matrix.version }}-linux-x64.tar.gz" >> $GITHUB_ENV
- name: Download and extract OpenSearch ${{ matrix.version }}
run: |
mkdir -p opensearch-${{ matrix.version }}
cd opensearch-${{ matrix.version }}
curl -L "${{ env.OPENSEARCH_URL }}" | tar -xz --strip-components=1
echo "OPENSEARCH_DIR=$(pwd)" >> $GITHUB_ENV
- name: Start OpenSearch
run: |
cd ${{ env.OPENSEARCH_DIR }}
# Configure OpenSearch for CI
echo "cluster.name: opensearch-ci" >> config/opensearch.yml
echo "network.host: localhost" >> config/opensearch.yml
echo "http.port: 9200" >> config/opensearch.yml
echo "transport.tcp.port: 9300" >> config/opensearch.yml
echo "discovery.type: single-node" >> config/opensearch.yml
echo "action.auto_create_index: true" >> config/opensearch.yml
echo "cluster.routing.allocation.disk.threshold_enabled: false" >> config/opensearch.yml
# Only disable security if the security plugin exists
if [ -d "plugins/opensearch-security" ]; then
echo "plugins.security.disabled: true" >> config/opensearch.yml
echo "Security plugin found, disabling it"
else
echo "No security plugin found, skipping security.disabled setting"
fi
# Start OpenSearch in background
nohup ./bin/opensearch > opensearch.log 2>&1 &
# Wait for OpenSearch to be ready
for i in {1..60}; do
if curl -s http://localhost:9200 >/dev/null; then
echo "OpenSearch is ready"
break
fi
echo "Waiting for OpenSearch... ($i/60)"
sleep 5
done
if ! curl -s http://localhost:9200 >/dev/null; then
echo "OpenSearch failed to start"
cat opensearch.log
exit 1
fi
- name: Run bootstrap
run: yarn osd bootstrap
- name: Build plugins
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10
- name: Build minimal OpenSearch Dashboards for testing
run: |
# Build only core platform without creating archives
yarn build:platform --linux --skip-archives || yarn build --skip-os-packages --skip-archives || {
echo "Standard build options failed, trying minimal build approach"
# Fallback: build only what's needed and clean aggressively
yarn build --skip-os-packages
# Clean up build artifacts to save space
rm -rf build/opensearch-dashboards/optimize/bundles/*.map
rm -rf build/opensearch-dashboards/node_modules/@types
rm -rf build/opensearch-dashboards/node_modules/typescript
find build/opensearch-dashboards/node_modules -name "*.d.ts" -delete
find build/opensearch-dashboards/node_modules -name "__tests__" -type d -exec rm -rf {} + 2>/dev/null || true
find build/opensearch-dashboards/node_modules -name "test" -type d -exec rm -rf {} + 2>/dev/null || true
}
# Find the built directory
OSD_BUILD_DIR=$(ls -d build/opensearch-dashboards* | head -1)
echo "OSD_INSTALL_DIR=$(pwd)/$OSD_BUILD_DIR" >> $GITHUB_ENV
echo "Built OpenSearch Dashboards in: $OSD_BUILD_DIR"
# Check disk usage
df -h
du -sh build/
- name: Run CI test group ${{ matrix.group }}
id: ftr-tests
run: node scripts/functional_tests.js --config test/functional/config.js --include ciGroup${{ matrix.group }} --opensearch-dashboards-install-dir ${{ env.OSD_INSTALL_DIR }}
env:
CI_GROUP: ciGroup${{ matrix.group }}
CI_PARALLEL_PROCESS_NUMBER: ciGroup${{ matrix.group }}
JOB: ci${{ matrix.group }}
CACHE_DIR: ciGroup${{ matrix.group }}
TEST_OPENSEARCH_URL: http://localhost:9200
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-artifacts-opensearch-${{ matrix.version }}-ci${{ matrix.group }}
path: |
test/*/failure_debug/
test/*/screenshots/
${{ env.OPENSEARCH_DIR }}/opensearch.log
overwrite: true
plugin-functional-tests:
name: Run plugin functional tests on ${{ matrix.name }} against OpenSearch ${{ matrix.version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
version:
[
3.3.0,
3.1.0,
2.19.0,
2.17.0,
2.15.0,
2.13.0,
2.11.0,
2.9.0,
2.7.0,
2.5.0,
2.3.0,
1.3.0,
1.2.0,
1.1.0,
1.0.0,
]
include:
- os: ubuntu-latest
name: Linux
runs-on: ${{ matrix.os }}
container:
image: docker://opensearchstaging/ci-runner:ci-runner-rockylinux8-opensearch-dashboards-integtest-v2
options: --user 1001 --privileged
steps:
- run: echo Running plugin functional tests
- name: Checkout code
uses: actions/checkout@v4
- name: Set Java version
run: |
if [[ "${{ matrix.version }}" == 1.* ]] || [[ "${{ matrix.version }}" == 2.* ]]; then
echo "JAVA_VERSION=17" >> $GITHUB_ENV
else
echo "JAVA_VERSION=21" >> $GITHUB_ENV
fi
echo "Using Java $JAVA_VERSION for OpenSearch ${{ matrix.version }}"
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'adopt'
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Setup Yarn
run: |
npm uninstall -g yarn
npm i -g yarn@1.22.10
yarn config set network-timeout 1000000 -g
- name: Configure Yarn Cache
run: echo "YARN_CACHE_LOCATION=$(yarn cache dir)" >> $GITHUB_ENV
- name: Initialize Yarn Cache
uses: actions/cache@v4
with:
path: ${{ env.YARN_CACHE_LOCATION }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Verify Chrome installation
run: |
which google-chrome || which chromium-browser || which chromium || echo "Chrome not found in PATH, but container may have it configured differently"
google-chrome --version || chromium-browser --version || chromium --version || echo "Chrome version check failed, but tests may still work"
- name: Setup chromedriver
run: node scripts/upgrade_chromedriver.js
- name: Run bootstrap
run: yarn osd bootstrap
- name: Build plugins
run: node scripts/build_opensearch_dashboards_platform_plugins --no-examples --workers 10 --scan-dir "./test/plugin_functional/plugins"
- name: Run functional plugin tests
id: plugin-ftr-tests
run: node scripts/functional_tests.js --config test/plugin_functional/config.ts
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-artifacts-plugin-functional-${{ matrix.os }}
path: |
test/*/failure_debug/
test/*/screenshots/
overwrite: true