Skip to content

Commit eb13318

Browse files
authored
Merge branch 'main' into md-serverless
2 parents 11b13ea + c5058a3 commit eb13318

File tree

44 files changed

+300
-443
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+300
-443
lines changed

.github/.codecov.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# https://docs.codecov.com/docs/codecov-yaml
2+
codecov:
3+
require_ci_to_pass: yes
4+
25
coverage:
36
status:
47
project:
58
default:
6-
# https://docs.codecov.com/docs/commit-status#target
7-
target: auto # coverage must be equal or above the previous commit
9+
target: auto
10+
threshold: 2% # the leniency in hitting the target
11+

.github/pull_request_template.md

+14-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@
44

55
### Issues Resolved
66

7-
<!-- List any issues this PR will resolve. -->
8-
<!-- Example: closes #1234 -->
7+
<!-- List any issues this PR will resolve. Prefix the issue with the keyword closes, fixes, fix -->
8+
<!-- Example: closes #1234 or fixes <Issue_URL> -->
9+
10+
## Screenshot
11+
12+
<!-- Attach any relevant screenshots. Any change to the UI requires an attached screenshot in the PR Description -->
13+
14+
## Testing the changes
15+
16+
<!--
17+
Please provide detailed steps for validating your changes. This could involve specific commands to run,
18+
pages to visit, scenarios to try or any other information that would help reviewers verify
19+
the functionality of your change
20+
-->
921

1022
### Check List
1123

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
134134
- [Table Visualization] Fix table rendering empty unused space ([#3797](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3797))
135135
- [Table Visualization] Fix data table not adjusting height on the initial load ([#3816](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3816))
136136
- Cleanup unused url ([#3847](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3847))
137+
- [BUG] Docked navigation impacts visibility of bottom bar component ([#3978](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3978))
137138

138139
### 🚞 Infrastructure
139140

@@ -149,6 +150,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
149150
- [CI] Reduce redundancy by using matrix strategy on Windows and Linux workflows ([#3514](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3514))
150151
- Add an achievement badger to the PR ([#3721](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3721))
151152
- Install chrome driver for functional tests from path set by environment variable `TEST_BROWSER_BINARY_PATH`([#3997](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3997))
153+
- Adds threshold to code coverage config to prevent workflow failures ([#4040](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4040))
152154

153155
### 📝 Documentation
154156

@@ -197,6 +199,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
197199
- [Console] Replace jQuery.ajax with core.http when calling OSD APIs in console ([#3080](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3080))
198200
- [I18n] Fix Listr type errors and error handlers ([#3629](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3629))
199201
- [Multiple DataSource] Present the authentication type choices in a drop-down ([#3693](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3693))
202+
- [Console] Remove unused ul element and its custom styling ([#3993](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3993))
203+
- Fix EUI/OUI type errors ([#3798](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3798))
200204

201205
### 🔩 Tests
202206

@@ -244,6 +248,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
244248
- [Multi DataSource] UX enhancement on Data source management stack ([#2521](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2521))
245249
- [Multi DataSource] UX enhancement on Update stored password modal for Data source management stack ([#2532](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/2532))
246250
- [Monaco editor] Add json worker support ([#3424](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3424))
251+
- Replace re2 with RegExp in timeline and add unit tests ([#3908](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3908))
247252

248253
### 🐛 Bug Fixes
249254

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@
200200
"pegjs": "0.10.0",
201201
"proxy-from-env": "1.0.0",
202202
"query-string": "^6.13.2",
203-
"re2": "1.17.4",
204203
"react": "^16.14.0",
205204
"react-dom": "^16.12.0",
206205
"react-input-range": "^1.3.0",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Version 1.3.10 Release Notes
2+
3+
### 🛡 Security
4+
5+
- [CVE-2020-15366][1.x] Bump ajv from 4.11.8 to 6.12.6 ([#4035](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4035))
6+
- [CVE-2022-48285][1.x] Bump jszip from 3.7.1 to 3.10.1 ([#4011](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4011))
7+
- [CVE-2021-35065][1.x] Bump glob-parent from 6.0.0 to 6.0.2 ([#4005](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4005))
8+
- [CVE-2022-25851][1.x] Bump jpeg-js from 0.4.1 to 0.4.4 ([#3860](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3860))
9+
- [CVE-2022-25858][1.x] Bump terser from 4.8.0 to 4.8.1 ([#3786](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3786))
10+
- [CVE-2021-23490][1.x] Bump parse-link-header from 1.0.1 to 2.0.0 ([#3820](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3820))
11+
- [CVE-2021-3765][1.x] Bump validator from 8.2.0 to 13.9.0 ([#3753](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3753))
12+
- [CVE-2022-25758][1.x] Bump scss-tokenizer from 0.3.0 to 0.4.3 ([#3789](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3789))
13+
- [CVE-2021-3803][1.x] Bump nth-check from 1.0.2 to 2.0.1 ([#3745](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3745))
14+
- Bump highlight.js from 9.18.5 to 10.7.3 to solve security concerns ([#4062](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4062))
15+
16+
### 📈 Features/Enhancements
17+
18+
- Add tooltip to help icon ([#3872](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3872))
19+
20+
### 🐛 Bug Fixes
21+
22+
- [TSVB] Fix the link to "serial differencing aggregation" documentation ([#3503](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3503))
23+
24+
### 📝 Documentation
25+
26+
- Update jest documentation links ([#3939](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3939))
27+
28+
### 🛠 Maintenance
29+
30+
- Add threshold to code coverage changes for project ([#4050](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4050))
31+
- Temporarily hardcode chromedriver to 112.0.0 to enable all ftr tests ([#4039]())
32+
- Update MAINTAINERS.md and CODEOWNERS ([#3938](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3938))
33+
- Add opensearch-dashboards-docker-dev to .gitignore ([#3781](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3781))

src/core/public/rendering/_base.scss

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
// SASSTODO: Naming here is too embedded and high up that changing them could cause major breaks
77
#opensearch-dashboards-body {
8-
overflow-x: hidden;
98
min-height: 100%;
109
}
1110

src/core/public/rendering/app_containers.test.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describe('AppWrapper', () => {
4343
expect(component.getDOMNode()).toMatchInlineSnapshot(`
4444
<div
4545
class="app-wrapper"
46+
id="app-wrapper"
4647
>
4748
app-content
4849
</div>
@@ -53,6 +54,7 @@ describe('AppWrapper', () => {
5354
expect(component.getDOMNode()).toMatchInlineSnapshot(`
5455
<div
5556
class="app-wrapper hidden-chrome"
57+
id="app-wrapper"
5658
>
5759
app-content
5860
</div>
@@ -63,6 +65,7 @@ describe('AppWrapper', () => {
6365
expect(component.getDOMNode()).toMatchInlineSnapshot(`
6466
<div
6567
class="app-wrapper"
68+
id="app-wrapper"
6669
>
6770
app-content
6871
</div>

src/core/public/rendering/app_containers.tsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ export const AppWrapper: React.FunctionComponent<{
3737
chromeVisible$: Observable<boolean>;
3838
}> = ({ chromeVisible$, children }) => {
3939
const visible = useObservable(chromeVisible$);
40-
return <div className={classNames('app-wrapper', { 'hidden-chrome': !visible })}>{children}</div>;
40+
return (
41+
<div id="app-wrapper" className={classNames('app-wrapper', { 'hidden-chrome': !visible })}>
42+
{children}
43+
</div>
44+
);
4145
};
4246

4347
export const AppContainer: React.FunctionComponent<{

src/dev/build/tasks/patch_native_modules_task.test.ts

+78-38
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
createAnyInstanceSerializer,
1010
createAbsolutePathSerializer,
1111
} from '@osd/dev-utils';
12-
import { Build, Config } from '../lib';
13-
import { PatchNativeModules } from './patch_native_modules_task';
12+
import { Build, Config, read, download, untar, gunzip } from '../lib';
13+
import { createPatchNativeModulesTask } from './patch_native_modules_task';
1414

1515
const log = new ToolingLog();
1616
const testWriter = new ToolingLogCollectingWriter();
@@ -19,16 +19,16 @@ expect.addSnapshotSerializer(createAnyInstanceSerializer(Config));
1919
expect.addSnapshotSerializer(createAnyInstanceSerializer(ToolingLog));
2020
expect.addSnapshotSerializer(createAbsolutePathSerializer());
2121

22-
jest.mock('../lib/download');
23-
jest.mock('../lib/fs', () => ({
24-
...jest.requireActual('../lib/fs'),
25-
untar: jest.fn(),
26-
gunzip: jest.fn(),
27-
}));
28-
29-
const { untar } = jest.requireMock('../lib/fs');
30-
const { gunzip } = jest.requireMock('../lib/fs');
31-
const { download } = jest.requireMock('../lib/download');
22+
jest.mock('../lib', () => {
23+
const originalModule = jest.requireActual('../lib');
24+
return {
25+
...originalModule,
26+
download: jest.fn(),
27+
gunzip: jest.fn(),
28+
untar: jest.fn(),
29+
read: jest.fn(),
30+
};
31+
});
3232

3333
async function setup() {
3434
const config = await Config.create({
@@ -38,14 +38,15 @@ async function setup() {
3838
linux: false,
3939
linuxArm: false,
4040
darwin: false,
41+
windows: false,
4142
},
4243
});
4344

4445
const build = new Build(config);
4546

46-
download.mockImplementation(() => {});
47-
untar.mockImplementation(() => {});
48-
gunzip.mockImplementation(() => {});
47+
(read as jest.MockedFunction<typeof read>).mockImplementation(async () => {
48+
return JSON.stringify({ version: mockPackage.version });
49+
});
4950

5051
return { config, build };
5152
}
@@ -55,38 +56,77 @@ beforeEach(() => {
5556
jest.clearAllMocks();
5657
});
5758

58-
it('patch native modules task downloads the correct platform package', async () => {
59-
const { config, build } = await setup();
60-
config.targetPlatforms.linuxArm = true;
61-
await PatchNativeModules.run(config, log, build);
62-
expect(download.mock.calls.length).toBe(1);
63-
expect(download.mock.calls).toMatchInlineSnapshot(`
59+
const mockPackage = {
60+
name: 'mock-native-module',
61+
version: '1.0.0',
62+
destinationPath: 'path/to/destination',
63+
extractMethod: 'untar',
64+
archives: {
65+
'linux-arm64': {
66+
url: 'https://example.com/mock-native-module/linux-arm64.tar.gz',
67+
sha256: 'mock-sha256',
68+
},
69+
'linux-x64': {
70+
url: 'https://example.com/mock-native-module/linux-x64.gz',
71+
sha256: 'mock-sha256',
72+
},
73+
},
74+
};
75+
76+
describe('patch native modules task', () => {
77+
it('patch native modules task downloads the correct platform package', async () => {
78+
const { config, build } = await setup();
79+
config.targetPlatforms.linuxArm = true;
80+
const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackage]);
81+
await PatchNativeModulesWithMock.run(config, log, build);
82+
expect((download as jest.MockedFunction<typeof download>).mock.calls.length).toBe(1);
83+
expect((download as jest.MockedFunction<typeof download>).mock.calls).toMatchInlineSnapshot(`
6484
Array [
6585
Array [
6686
Object {
67-
"destination": <absolute path>/.native_modules/re2/linux-arm64-83.tar.gz,
87+
"destination": <absolute path>/.native_modules/mock-native-module/linux-arm64.tar.gz,
6888
"log": <ToolingLog>,
6989
"retries": 3,
70-
"sha256": "d86ced75b794fbf518b90908847b3c09a50f3ff5a2815aa30f53080f926a2873",
71-
"url": "https://d1v1sj258etie.cloudfront.net/node-re2/releases/download/1.17.4/linux-arm64-83.tar.gz",
90+
"sha256": "mock-sha256",
91+
"url": "https://example.com/mock-native-module/linux-arm64.tar.gz",
7292
},
7393
],
7494
]
7595
`);
76-
});
96+
});
7797

78-
it('for .tar.gz artifact, patch native modules task unzip it via untar', async () => {
79-
const { config, build } = await setup();
80-
config.targetPlatforms.linuxArm = true;
81-
await PatchNativeModules.run(config, log, build);
82-
expect(untar.mock.calls.length).toBe(1);
83-
expect(gunzip.mock.calls.length).toBe(0);
84-
});
98+
it('for .tar.gz artifact, patch native modules task unzip it via untar', async () => {
99+
const { config, build } = await setup();
100+
config.targetPlatforms.linuxArm = true;
101+
const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackage]);
102+
await PatchNativeModulesWithMock.run(config, log, build);
103+
expect(untar).toHaveBeenCalled();
104+
expect(gunzip).not.toHaveBeenCalled();
105+
});
85106

86-
it('for .gz artifact, patch native modules task unzip it via gunzip', async () => {
87-
const { config, build } = await setup();
88-
config.targetPlatforms.linux = true;
89-
await PatchNativeModules.run(config, log, build);
90-
expect(untar.mock.calls.length).toBe(0);
91-
expect(gunzip.mock.calls.length).toBe(1);
107+
it('for .gz artifact, patch native modules task unzip it via gunzip', async () => {
108+
const mockPackageGZ = {
109+
...mockPackage,
110+
extractMethod: 'gunzip',
111+
};
112+
const { config, build } = await setup();
113+
config.targetPlatforms.linux = true;
114+
const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackageGZ]);
115+
await PatchNativeModulesWithMock.run(config, log, build);
116+
expect(gunzip).toHaveBeenCalled();
117+
expect(untar).not.toHaveBeenCalled();
118+
});
119+
120+
it('throws error for unsupported extract methods', async () => {
121+
const mockPackageUnsupported = {
122+
...mockPackage,
123+
extractMethod: 'unsupported',
124+
};
125+
const { config, build } = await setup();
126+
config.targetPlatforms.linux = true;
127+
const PatchNativeModulesWithMock = createPatchNativeModulesTask([mockPackageUnsupported]);
128+
await expect(PatchNativeModulesWithMock.run(config, log, build)).rejects.toThrow(
129+
'Extract method of unsupported is not supported'
130+
);
131+
});
92132
});

src/dev/build/tasks/patch_native_modules_task.ts

+18-51
Original file line numberDiff line numberDiff line change
@@ -52,45 +52,7 @@ interface Package {
5252
>;
5353
}
5454

55-
/* Process for updating URLs and checksums after bumping the version of `re2` or NodeJS:
56-
* 1. Match the `version` with the version in the yarn.lock file.
57-
* 2. Match the module version, the digits at the end of the filename, with the output of
58-
* `node -p process.versions.modules`.
59-
* 3. Confirm that the URLs exist for each platform-architecture combo on
60-
* https://github.com/uhop/node-re2/releases/tag/[VERSION]; reach out to maintainers for ARM
61-
* releases of `re2` as they currently don't have an official ARM release.
62-
* 4. Generate new checksums for each artifact by downloading each one and calling
63-
* `shasum -a 256` or `sha256sum` on the downloaded file.
64-
*/
65-
const packages: Package[] = [
66-
{
67-
name: 're2',
68-
version: '1.17.4',
69-
destinationPath: 'node_modules/re2/build/Release/re2.node',
70-
extractMethod: 'gunzip',
71-
archives: {
72-
'darwin-x64': {
73-
url: 'https://github.com/uhop/node-re2/releases/download/1.17.4/darwin-x64-83.gz',
74-
sha256: '9112ed93c1544ecc6397f7ff20bd2b28f3b04c7fbb54024e10f9a376a132a87d',
75-
},
76-
'linux-x64': {
77-
url: 'https://github.com/uhop/node-re2/releases/download/1.17.4/linux-x64-83.gz',
78-
sha256: '86e03540783a18c41f81df0aec320b1f64aca6cbd3a87fc1b7a9b4109c5f5986',
79-
},
80-
'linux-arm64': {
81-
url:
82-
'https://d1v1sj258etie.cloudfront.net/node-re2/releases/download/1.17.4/linux-arm64-83.tar.gz',
83-
sha256: 'd86ced75b794fbf518b90908847b3c09a50f3ff5a2815aa30f53080f926a2873',
84-
overriddenExtractMethod: 'untar',
85-
overriddenDestinationPath: 'node_modules/re2/build/Release',
86-
},
87-
'win32-x64': {
88-
url: 'https://github.com/uhop/node-re2/releases/download/1.17.4/win32-x64-83.gz',
89-
sha256: '2f842d9757288afd4bd5dec0e7b370a4c3e89ac98050598b17abb9e8e00e3294',
90-
},
91-
},
92-
},
93-
];
55+
export const packages: Package[] = [];
9456

9557
async function getInstalledVersion(config: Config, packageName: string) {
9658
const packageJSONPath = config.resolveFromRepo(
@@ -145,15 +107,20 @@ async function patchModule(
145107
}
146108
}
147109

148-
export const PatchNativeModules: Task = {
149-
description: 'Patching platform-specific native modules',
150-
async run(config, log, build) {
151-
for (const pkg of packages) {
152-
await Promise.all(
153-
config.getTargetPlatforms().map(async (platform) => {
154-
await patchModule(config, log, build, platform, pkg);
155-
})
156-
);
157-
}
158-
},
159-
};
110+
export function createPatchNativeModulesTask(customPackages?: Package[]): Task {
111+
return {
112+
description: 'Patching platform-specific native modules',
113+
async run(config, log, build) {
114+
const targetPackages = customPackages || packages;
115+
for (const pkg of targetPackages) {
116+
await Promise.all(
117+
config.getTargetPlatforms().map(async (platform) => {
118+
await patchModule(config, log, build, platform, pkg);
119+
})
120+
);
121+
}
122+
},
123+
};
124+
}
125+
126+
export const PatchNativeModules = createPatchNativeModulesTask();

0 commit comments

Comments
 (0)