Skip to content

Commit

Permalink
Merge branch '2.x' into backport/backport-3955-to-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
kavilla authored May 26, 2023
2 parents 3cef4b9 + bf59644 commit 94c4a42
Show file tree
Hide file tree
Showing 78 changed files with 4,328 additions and 3,882 deletions.
25 changes: 5 additions & 20 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ env:
TEST_OPENSEARCH_TRANSPORT_PORT: 9403
TEST_OPENSEARCH_PORT: 9400
OSD_SNAPSHOT_SKIP_VERIFY_CHECKSUM: true
# Version 112.0.5615.0
CHROME_VERSION: 1109208
NODE_OPTIONS: "--max-old-space-size=6144 --dns-result-order=ipv4first"

jobs:
build-lint-test:
name: Build and Verify on ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
include:
Expand Down Expand Up @@ -137,22 +137,6 @@ jobs:
steps:
- run: echo Running functional tests for ciGroup${{ matrix.group }}

- name: Setup Chrome
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: ${{ env.CHROME_VERSION }}

- name: Set Chrome Path
if: matrix.os != 'windows-latest'
run: |
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
- name: Set Chrome Path (Windows)
if: matrix.os == 'windows-latest'
run: |
echo "TEST_BROWSER_BINARY_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $env:GITHUB_ENV
- name: Configure git's autocrlf (Windows only)
if: matrix.os == 'windows-latest'
run: |
Expand Down Expand Up @@ -403,6 +387,7 @@ jobs:
with:
name: ${{ matrix.version }}-test-failures
path: |
./artifacts/bwc_tmp/test/cypress/videos/without-security/*
./artifacts/bwc_tmp/test/cypress/screenshots/without-security/*
./artifacts/bwc_tmp/test/cypress/videos/*
./artifacts/bwc_tmp/test/cypress/screenshots/*
./artifacts/bwc_tmp/test/cypress/results/*
retention-days: 1
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.21.3
16.20.0
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.21.3
16.20.0
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [VisBuilder] Add metric to metric, bucket to bucket aggregation persistence ([#3495](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3495))
- [VisBuilder] Add UI actions handler ([#3732](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3732))
- [VisBuilder] Add persistence to visualizations inner state ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751))
- Add satisfaction survey link to help menu ([#3676] (https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3676))
- [Vis Builder] Add persistence to visualizations inner state ([#3751](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3751))
- [Table Visualization] Move format table, consolidate types and add unit tests ([#3397](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3397))
- [Multiple Datasource] Support Amazon OpenSearch Serverless ([#3957](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3957))
- Add support for Node.js >=14.20.1 <19 ([#4071](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4071))

### 🐛 Bug Fixes

Expand Down Expand Up @@ -89,6 +94,9 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

- Update caniuse to `1.0.30001460` to fix failed integration tests ([#3538](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3538))
- [Tests] Fix unit tests for `get_keystore` ([#3854](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3854))
- [Tests] Use `scripts/use_node` instead of `node` in functional test plugins ([#3783](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3783))

## [2.x]

## [2.6.0]

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG NODE_VERSION=14.20.1
ARG NODE_VERSION=18.16.0
FROM node:${NODE_VERSION} AS base

ENV HOME '.'
Expand Down
18 changes: 10 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"test:jest:ci": "scripts/use_node scripts/jest --ci --colors --runInBand",
"test:jest:ci:coverage": "scripts/use_node scripts/jest --ci --colors --runInBand --coverage",
"test:jest_integration": "scripts/use_node scripts/jest_integration",
"test:jest_integration:ci": "scripts/use_node scripts/jest_integration --ci --colors --max-old-space-size=5120",
"test:jest_integration:ci": "scripts/use_node scripts/jest_integration --ci --colors",
"test:mocha": "scripts/use_node scripts/mocha",
"test:mocha:coverage": "yarn nyc --reporter=text-summary --reporter=lcov --report-dir=./target/opensearch-dashboards-coverage/mocha scripts/use_node scripts/mocha",
"test:ftr": "scripts/use_node scripts/functional_tests",
Expand Down Expand Up @@ -79,7 +79,7 @@
"url": "https://github.com/opensearch-project/opensearch-dashboards.git"
},
"resolutions": {
"**/@types/node": "^14.17.32",
"**/@types/node": "~18.7.0",
"**/ansi-regex": "^5.0.1",
"**/async": "^3.2.3",
"**/d3-color": "^3.1.0",
Expand All @@ -99,6 +99,7 @@
"**/minimatch": "^3.0.5",
"**/jest-config": "npm:@amoo-miki/[email protected]",
"**/jest-jasmine2": "npm:@amoo-miki/[email protected]",
"**/set-value": "^4.1.0",
"**/xml2js": "^0.5.0",
"**/yaml": "^2.2.2"
},
Expand Down Expand Up @@ -170,7 +171,7 @@
"deep-freeze-strict": "^1.1.1",
"del": "^6.1.1",
"dns-sync": "^0.2.1",
"elastic-apm-node": "^3.7.0",
"elastic-apm-node": "^3.43.0",
"elasticsearch": "^16.7.0",
"http-aws-es": "npm:@zhongnansu/[email protected]",
"execa": "^4.0.2",
Expand All @@ -180,7 +181,7 @@
"getos": "^3.2.1",
"glob": "^7.1.7",
"glob-all": "^3.2.1",
"globby": "^8.0.1",
"globby": "^11.1.0",
"handlebars": "4.7.7",
"hjson": "3.2.1",
"http-proxy-agent": "^2.1.0",
Expand Down Expand Up @@ -215,6 +216,7 @@
"rison-node": "1.0.2",
"rxjs": "^6.5.5",
"semver": "^5.7.0",
"set-value": "^4.1.0",
"source-map-support": "^0.5.19",
"symbol-observable": "^1.2.0",
"tar": "^6.1.11",
Expand Down Expand Up @@ -305,7 +307,7 @@
"@types/mock-fs": "^4.10.0",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
"@types/node": "^14.17.32",
"@types/node": "~18.7.0",
"@types/node-forge": "^1.0.1",
"@types/normalize-path": "^3.0.0",
"@types/pegjs": "^0.10.1",
Expand Down Expand Up @@ -400,7 +402,7 @@
"immer": "^9.0.6",
"intl-messageformat-parser": "^1.4.0",
"jest": "^27.5.1",
"jest-canvas-mock": "^2.3.1",
"jest-canvas-mock": "^2.5.1",
"jest-raw-loader": "^1.0.1",
"jimp": "^0.14.0",
"jquery": "^3.5.0",
Expand Down Expand Up @@ -473,7 +475,7 @@
"zlib": "^1.0.5"
},
"engines": {
"node": "^14.20.1",
"yarn": "^1.21.1"
"node": ">=14.20.1 <19",
"yarn": "^1.22.10"
}
}
2 changes: 1 addition & 1 deletion packages/osd-ace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"@osd/babel-preset": "1.0.0",
"raw-loader": "^4.0.2",
"typescript": "4.0.2",
"webpack": "^4.41.5"
"webpack": "npm:@amoo-miki/[email protected]"
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions packages/osd-config-schema/src/errors/schema_error.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ import { SchemaError } from '.';

import { standardize, getRepoRoot } from '@osd/cross-platform';

// ToDo: Remove this logic when Node 14 support is removed
const isNode14 = process.version.startsWith('v14.');

/**
* Make all paths in stacktrace relative.
*/
export const cleanStack = (stack: string) =>
stack
export const cleanStack = (stack: string) => {
const result = stack
.split('\n')
.filter((line) => !line.includes('node_modules' + sep) && !line.includes('internal/'))
.map((line) => {
Expand All @@ -54,6 +57,11 @@ export const cleanStack = (stack: string) =>
})
.join('\n');

return isNode14
? result.replace(/Error:\s([^\n]+)\n\s*at new ([^ ]+) [^\n]*\n/, '$2: $1\n')
: result;
};

it('includes stack', () => {
try {
throw new SchemaError('test');
Expand Down
1 change: 1 addition & 0 deletions packages/osd-config-schema/src/errors/schema_error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class SchemaError extends Error {
constructor(message: string, cause?: Error) {
super(message);
this.cause = cause;
this.name = this.constructor.name;

// Set the prototype explicitly, see:
// https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work
Expand Down
18 changes: 9 additions & 9 deletions packages/osd-config/src/config_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ test('throws if config at path does not match schema', async () => {
);

await expect(valuesReceived).toMatchInlineSnapshot(`
Array [
[Error: [config validation of [key]]: expected value of type [string] but got [number]],
]
`);
Array [
[ValidationError: [config validation of [key]]: expected value of type [string] but got [number]],
]
`);
});

test('re-validate config when updated', async () => {
Expand All @@ -120,11 +120,11 @@ test('re-validate config when updated', async () => {
rawConfig$.next({ key: 123 });

await expect(valuesReceived).toMatchInlineSnapshot(`
Array [
"value",
[Error: [config validation of [key]]: expected value of type [string] but got [number]],
]
`);
Array [
"value",
[ValidationError: [config validation of [key]]: expected value of type [string] but got [number]],
]
`);
});

test("returns undefined if fetching optional config at a path that doesn't exist", async () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/osd-cross-platform/src/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import path from 'path';
import fs from 'fs';
import { access, rmdir, mkdir, writeFile, symlink } from 'fs/promises';
import { access, rm, mkdir, writeFile, symlink } from 'fs/promises';

import {
resolveToFullNameSync,
Expand Down Expand Up @@ -43,9 +43,9 @@ describe('Cross Platform', () => {
try {
// If leftover artifacts were found, get rid of them
await access(tmpTestFolder);
await rmdir(tmpTestFolder, { recursive: true });
await rm(tmpTestFolder, { recursive: true });
} catch (ex) {
// Do nothing; if `rmdir` failed, let the `mkdir` below throw the error
// Do nothing; if `rm` failed, let the `mkdir` below throw the error
}

await mkdir(tmpTestFolder);
Expand All @@ -60,7 +60,7 @@ describe('Cross Platform', () => {

afterAll(async () => {
try {
await rmdir(tmpTestFolder, { recursive: true });
await rm(tmpTestFolder, { recursive: true });
} catch (ex) {
// Do nothing
}
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"execa": "^4.0.2",
"exit-hook": "^2.2.0",
"getopts": "^2.2.5",
"globby": "^8.0.1",
"globby": "^11.1.0",
"load-json-file": "^6.2.0",
"markdown-it": "^12.3.2",
"moment": "^2.24.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/osd-dev-utils/src/proc_runner/proc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ export function startProc(name: string, options: ProcOptions, log: ToolingLog) {
await withTimeout(
async () => {
log.debug(`Sending "${signal}" to proc "${name}"`);
await treeKillAsync(childProcess.pid, signal);
await treeKillAsync(childProcess.pid!, signal);
await outcomePromise;
},
STOP_TIMEOUT,
async () => {
log.warning(
`Proc "${name}" was sent "${signal}" didn't emit the "exit" or "error" events after ${STOP_TIMEOUT} ms, sending SIGKILL`
);
await treeKillAsync(childProcess.pid, 'SIGKILL');
await treeKillAsync(childProcess.pid!, 'SIGKILL');
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ export function createAbsolutePathSerializer(
) {
const rootPaths = Array.isArray(rootPath) ? rootPath : [rootPath];

if (process.platform === 'win32') {
rootPaths.push(...rootPaths.map((name) => name.replace(/\\/g, '/')));
}

return {
test: (value: any) =>
typeof value === 'string' && rootPaths.some((path) => value.startsWith(path)),
Expand Down
1 change: 1 addition & 0 deletions packages/osd-dev-utils/src/serializers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ export * from './strip_ansi_serializer';
export * from './recursive_serializer';
export * from './any_instance_serizlizer';
export * from './replace_serializer';
export * from './strip_promises_serizlizer';
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export const createStripPromisesSerializer = () => ({
serialize: (value: string) => value.replace(/("value": Promise) \{[^}]+}/gm, '$1 {}'),
test: (value: any) => typeof value === 'string',
});
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
* under the License.
*/

import Path from 'path';
import { resolve } from 'path';
import { standardize } from '@osd/cross-platform';

import globby from 'globby';

Expand All @@ -47,24 +48,23 @@ export function simpleOpenSearchDashboardsPlatformPluginDiscovery(
...scanDirs.reduce(
(acc: string[], dir) => [
...acc,
Path.resolve(dir, '*/opensearch_dashboards.json'),
Path.resolve(dir, '*/*/opensearch_dashboards.json'),
Path.resolve(dir, '*/*/*/opensearch_dashboards.json'),
Path.resolve(dir, '*/*/*/*/opensearch_dashboards.json'),
Path.resolve(dir, '*/*/*/*/*/opensearch_dashboards.json'),
resolve(dir, '*/opensearch_dashboards.json'),
resolve(dir, '*/*/opensearch_dashboards.json'),
resolve(dir, '*/*/*/opensearch_dashboards.json'),
resolve(dir, '*/*/*/*/opensearch_dashboards.json'),
resolve(dir, '*/*/*/*/*/opensearch_dashboards.json'),
],
[]
),
...pluginPaths.map((path) => Path.resolve(path, `opensearch_dashboards.json`)),
...pluginPaths.map((path) => resolve(path, `opensearch_dashboards.json`)),
])
);

const manifestPaths = globby.sync(patterns, { absolute: true }).map((path) =>
// absolute paths returned from globby are using normalize or
// something so the path separators are `/` even on windows,
// Path.resolve solves this
Path.resolve(path)
);
const standardizedPatterns = patterns.map((pattern) => standardize(pattern));

const manifestPaths = globby
.sync(standardizedPatterns, { absolute: true })
.map((path) => standardize(resolve(path)));

return manifestPaths.map(parseOpenSearchDashboardsPlatformPlugin);
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"glob-all": "^3.2.1",
"lru-cache": "^4.1.5",
"resolve": "^1.7.1",
"webpack": "^4.41.5"
"webpack": "npm:@amoo-miki/[email protected]"
}
}
Loading

0 comments on commit 94c4a42

Please sign in to comment.