Skip to content

Commit 42e85d6

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into implement/report-doc-changes-url-in-prs
2 parents 60bd4c1 + 3720006 commit 42e85d6

File tree

20 files changed

+1290
-43
lines changed

20 files changed

+1290
-43
lines changed

vars/kibanaPipeline.groovy

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,27 @@ def withTasks(Map params = [worker: [:]], Closure closure) {
447447
}
448448

449449
def allCiTasks() {
450-
withTasks {
451-
tasks.check()
452-
tasks.lint()
453-
tasks.test()
454-
tasks.functionalOss()
455-
tasks.functionalXpack()
456-
}
450+
parallel([
451+
general: {
452+
withTasks {
453+
tasks.check()
454+
tasks.lint()
455+
tasks.test()
456+
tasks.functionalOss()
457+
tasks.functionalXpack()
458+
}
459+
},
460+
jest: {
461+
workers.ci(name: 'jest', size: 'c2-8', ramDisk: true) {
462+
scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh')()
463+
}
464+
},
465+
xpackJest: {
466+
workers.ci(name: 'xpack-jest', size: 'c2-8', ramDisk: true) {
467+
scriptTask('X-Pack Jest Unit Tests', 'test/scripts/test/xpack_jest_unit.sh')()
468+
}
469+
},
470+
])
457471
}
458472

459473
def pipelineLibraryTests() {

vars/tasks.groovy

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,9 @@ def lint() {
3030

3131
def test() {
3232
tasks([
33-
// These 2 tasks require isolation because of hard-coded, conflicting ports and such, so let's use Docker here
33+
// This task requires isolation because of hard-coded, conflicting ports and such, so let's use Docker here
3434
kibanaPipeline.scriptTaskDocker('Jest Integration Tests', 'test/scripts/test/jest_integration.sh'),
35-
36-
kibanaPipeline.scriptTask('Jest Unit Tests', 'test/scripts/test/jest_unit.sh'),
3735
kibanaPipeline.scriptTask('API Integration Tests', 'test/scripts/test/api_integration.sh'),
38-
kibanaPipeline.scriptTask('X-Pack Jest Unit Tests', 'test/scripts/test/xpack_jest_unit.sh'),
3936
])
4037
}
4138

vars/workers.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def label(size) {
1919
return 'docker && tests-xl-highmem'
2020
case 'xxl':
2121
return 'docker && tests-xxl && gobld/machineType:custom-64-270336'
22+
case 'c2-8':
23+
return 'docker && linux && immutable && gobld/machineType:c2-standard-8'
2224
}
2325

2426
error "unknown size '${size}'"

x-pack/build_chromium/README.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,65 @@ to accept a commit hash from the Chromium repository, and initialize the build
66
environments and run the build on Mac, Windows, and Linux.
77

88
## Before you begin
9+
910
If you wish to use a remote VM to build, you'll need access to our GCP account,
1011
which is where we have two machines provisioned for the Linux and Windows
1112
builds. Mac builds can be achieved locally, and are a great place to start to
1213
gain familiarity.
1314

15+
**NOTE:** Linux builds should be done in Ubuntu on x86 architecture. ARM builds
16+
are created in x86. CentOS is not supported for building Chromium.
17+
1418
1. Login to our GCP instance [here using your okta credentials](https://console.cloud.google.com/).
1519
2. Click the "Compute Engine" tab.
16-
3. Ensure that `chromium-build-linux` and `chromium-build-windows-12-beefy` are there.
17-
4. If #3 fails, you'll have to spin up new instances. Generally, these need `n1-standard-8` types or 8 vCPUs/30 GB memory.
18-
5. Ensure that there's enough room left on the disk: 100GB is required. `ncdu` is a good linux util to verify what's claming space.
19-
20-
## Usage
20+
3. Find `chromium-build-linux` or `chromium-build-windows-12-beefy` and start the instance.
21+
4. Install [Google Cloud SDK](https://cloud.google.com/sdk) locally to ssh into the GCP instance
22+
5. System dependencies:
23+
- 8 CPU
24+
- 30GB memory
25+
- 80GB free space on disk (Try `ncdu /home` to see where space is used.)
26+
- git
27+
- python2 (`python` must link to `python2`)
28+
- lsb_release
29+
- tmux is recommended in case your ssh session is interrupted
30+
6. Copy the entire `build_chromium` directory into a GCP storage bucket, so you can copy the scripts into the instance and run them.
31+
32+
## Build Script Usage
2133

2234
```
35+
# Allow our scripts to use depot_tools commands
2336
export PATH=$HOME/chromium/depot_tools:$PATH
37+
2438
# Create a dedicated working directory for this directory of Python scripts.
2539
mkdir ~/chromium && cd ~/chromium
40+
2641
# Copy the scripts from the Kibana repo to use them conveniently in the working directory
27-
cp -r ~/path/to/kibana/x-pack/build_chromium .
28-
# Install the OS packages, configure the environment, download the chromium source
42+
gsutil cp -r gs://my-bucket/build_chromium .
43+
44+
# Install the OS packages, configure the environment, download the chromium source (25GB)
2945
python ./build_chromium/init.sh [arch_name]
3046
3147
# Run the build script with the path to the chromium src directory, the git commit id
32-
python ./build_chromium/build.py <commit_id>
48+
python ./build_chromium/build.py <commit_id> x86
3349
34-
# You can add an architecture flag for ARM
50+
# OR You can build for ARM
3551
python ./build_chromium/build.py <commit_id> arm64
3652
```
3753

54+
**NOTE:** The `init.py` script updates git config to make it more possible for
55+
the Chromium repo to be cloned successfully. If checking out the Chromium fails
56+
with "early EOF" errors, the instance could be low on memory or disk space.
57+
3858
## Getting the Commit ID
39-
Getting `<commit_id>` can be tricky. The best technique seems to be:
59+
The `build.py` script requires a commit ID of the Chromium repo. Getting `<commit_id>` can be tricky. The best technique seems to be:
4060
1. Create a temporary working directory and intialize yarn
4161
2. `yarn add puppeteer # install latest puppeter`
42-
3. Look through puppeteer's node module files to find the "chromium revision" (a custom versioning convention for Chromium).
62+
3. Look through Puppeteer documentation and Changelogs to find information
63+
about where the "chromium revision" is located in the Puppeteer code. The code
64+
containing it might not be distributed in the node module.
65+
- Example: https://github.com/puppeteer/puppeteer/blob/b549256/src/revisions.ts
4366
4. Use `https://crrev.com` and look up the revision and find the git commit info.
44-
45-
The official Chromium build process is poorly documented, and seems to have
46-
breaking changes fairly regularly. The build pre-requisites, and the build
47-
flags change over time, so it is likely that the scripts in this directory will
48-
be out of date by the time we have to do another Chromium build.
49-
50-
This document is an attempt to note all of the gotchas we've come across while
51-
building, so that the next time we have to tinker here, we'll have a good
52-
starting point.
67+
- Example: http://crrev.com/818858 leads to the git commit e62cb7e3fc7c40548cef66cdf19d270535d9350b
5368

5469
## Build args
5570

@@ -115,8 +130,8 @@ The more cores the better, as the build makes effective use of each. For Linux,
115130

116131
- Linux:
117132
- SSH in using [gcloud](https://cloud.google.com/sdk/)
118-
- Get the ssh command in the [GCP console](https://console.cloud.google.com/) -> VM instances -> your-vm-name -> SSH -> gcloud
119-
- Their in-browser UI is kinda sluggish, so use the commandline tool
133+
- Get the ssh command in the [GCP console](https://console.cloud.google.com/) -> VM instances -> your-vm-name -> SSH -> "View gcloud command"
134+
- Their in-browser UI is kinda sluggish, so use the commandline tool (Google Cloud SDK is required)
120135

121136
- Windows:
122137
- Install Microsoft's Remote Desktop tools

x-pack/build_chromium/build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
base_version = source_version[:7].strip('.')
3434

3535
# Set to "arm" to build for ARM on Linux
36-
arch_name = sys.argv[2] if len(sys.argv) >= 3 else 'x64'
36+
arch_name = sys.argv[2] if len(sys.argv) >= 3 else 'unknown'
3737

3838
if arch_name != 'x64' and arch_name != 'arm64':
39-
raise Exception('Unexpected architecture: ' + arch_name)
39+
raise Exception('Unexpected architecture: ' + arch_name + '. `x64` and `arm64` are supported.')
4040

4141
print('Building Chromium ' + source_version + ' for ' + arch_name + ' from ' + src_path)
4242
print('src path: ' + src_path)

x-pack/build_chromium/init.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,19 @@
88
# call this once the platform-specific initialization has completed.
99

1010
# Set to "arm" to build for ARM on Linux
11-
arch_name = sys.argv[1] if len(sys.argv) >= 2 else 'x64'
11+
arch_name = sys.argv[1] if len(sys.argv) >= 2 else 'undefined'
1212
build_path = path.abspath(os.curdir)
1313
src_path = path.abspath(path.join(build_path, 'chromium', 'src'))
1414

1515
if arch_name != 'x64' and arch_name != 'arm64':
16-
raise Exception('Unexpected architecture: ' + arch_name)
16+
raise Exception('Unexpected architecture: ' + arch_name + '. `x64` and `arm64` are supported.')
1717

1818
# Configure git
1919
print('Configuring git globals...')
2020
runcmd('git config --global core.autocrlf false')
2121
runcmd('git config --global core.filemode false')
2222
runcmd('git config --global branch.autosetuprebase always')
23+
runcmd('git config --global core.compression 0')
2324

2425
# Grab Chromium's custom build tools, if they aren't already installed
2526
# (On Windows, they are installed before this Python script is run)
@@ -35,13 +36,14 @@
3536
runcmd('git pull origin master')
3637
os.chdir(original_dir)
3738

38-
configure_environment(arch_name, build_path, src_path)
39-
4039
# Fetch the Chromium source code
4140
chromium_dir = path.join(build_path, 'chromium')
4241
if not path.isdir(chromium_dir):
4342
mkdir(chromium_dir)
4443
os.chdir(chromium_dir)
45-
runcmd('fetch chromium')
44+
runcmd('fetch chromium --nohooks=1 --no-history=1')
4645
else:
4746
print('Directory exists: ' + chromium_dir + '. Skipping chromium fetch.')
47+
48+
# This depends on having the chromium/src directory with the complete checkout
49+
configure_environment(arch_name, build_path, src_path)

x-pack/plugins/enterprise_search/public/applications/workplace_search/app_logic.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface AppValues extends WorkplaceSearchInitialData {
2121
interface AppActions {
2222
initializeAppData(props: InitialAppData): InitialAppData;
2323
setContext(isOrganization: boolean): boolean;
24+
setSourceRestriction(canCreatePersonalSources: boolean): boolean;
2425
}
2526

2627
const emptyOrg = {} as Organization;
@@ -34,6 +35,7 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions>>({
3435
isFederatedAuth,
3536
}),
3637
setContext: (isOrganization) => isOrganization,
38+
setSourceRestriction: (canCreatePersonalSources: boolean) => canCreatePersonalSources,
3739
},
3840
reducers: {
3941
hasInitialized: [
@@ -64,6 +66,10 @@ export const AppLogic = kea<MakeLogicType<AppValues, AppActions>>({
6466
emptyAccount,
6567
{
6668
initializeAppData: (_, { workplaceSearch }) => workplaceSearch?.account || emptyAccount,
69+
setSourceRestriction: (state, canCreatePersonalSources) => ({
70+
...state,
71+
canCreatePersonalSources,
72+
}),
6773
},
6874
],
6975
},

x-pack/plugins/enterprise_search/public/applications/workplace_search/components/layout/nav.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ export const WorkplaceSearchNav: React.FC<Props> = ({
4545
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${ROLE_MAPPINGS_PATH}`)}>
4646
{NAV.ROLE_MAPPINGS}
4747
</SideNavLink>
48-
<SideNavLink isExternal to={getWorkplaceSearchUrl(`#${SECURITY_PATH}`)}>
49-
{NAV.SECURITY}
50-
</SideNavLink>
48+
<SideNavLink to={SECURITY_PATH}>{NAV.SECURITY}</SideNavLink>
5149
<SideNavLink subNav={settingsSubNav} to={ORG_SETTINGS_PATH}>
5250
{NAV.SETTINGS}
5351
</SideNavLink>

x-pack/plugins/enterprise_search/public/applications/workplace_search/constants.ts

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,87 @@ export const DOCUMENTATION_LINK_TITLE = i18n.translate(
289289
}
290290
);
291291

292+
export const PRIVATE_SOURCES_DESCRIPTION = i18n.translate(
293+
'xpack.enterpriseSearch.workplaceSearch.security.privateSources.description',
294+
{
295+
defaultMessage:
296+
'Private sources are connected by users in your organization to create a personalized search experience.',
297+
}
298+
);
299+
300+
export const PRIVATE_SOURCES_TOGGLE_DESCRIPTION = i18n.translate(
301+
'xpack.enterpriseSearch.workplaceSearch.security.privateSourcesToggle.description',
302+
{
303+
defaultMessage: 'Enable private sources for your organization',
304+
}
305+
);
306+
307+
export const REMOTE_SOURCES_TOGGLE_TEXT = i18n.translate(
308+
'xpack.enterpriseSearch.workplaceSearch.security.remoteSourcesToggle.text',
309+
{
310+
defaultMessage: 'Enable remote private sources',
311+
}
312+
);
313+
314+
export const REMOTE_SOURCES_TABLE_DESCRIPTION = i18n.translate(
315+
'xpack.enterpriseSearch.workplaceSearch.security.remoteSourcesTable.description',
316+
{
317+
defaultMessage:
318+
'Remote sources synchronize and store a limited amount of data on disk, with a low impact on storage resources.',
319+
}
320+
);
321+
322+
export const REMOTE_SOURCES_EMPTY_TABLE_TITLE = i18n.translate(
323+
'xpack.enterpriseSearch.workplaceSearch.security.remoteSourcesEmptyTable.title',
324+
{
325+
defaultMessage: 'No remote private sources configured yet',
326+
}
327+
);
328+
329+
export const STANDARD_SOURCES_TOGGLE_TEXT = i18n.translate(
330+
'xpack.enterpriseSearch.workplaceSearch.security.standardSourcesToggle.text',
331+
{
332+
defaultMessage: 'Enable standard private sources',
333+
}
334+
);
335+
336+
export const STANDARD_SOURCES_TABLE_DESCRIPTION = i18n.translate(
337+
'xpack.enterpriseSearch.workplaceSearch.security.standardSourcesTable.description',
338+
{
339+
defaultMessage:
340+
'Standard sources synchronize and store all searchable data on disk, with a directly correlated impact on storage resources.',
341+
}
342+
);
343+
344+
export const STANDARD_SOURCES_EMPTY_TABLE_TITLE = i18n.translate(
345+
'xpack.enterpriseSearch.workplaceSearch.security.standardSourcesEmptyTable.title',
346+
{
347+
defaultMessage: 'No standard private sources configured yet',
348+
}
349+
);
350+
351+
export const SECURITY_UNSAVED_CHANGES_MESSAGE = i18n.translate(
352+
'xpack.enterpriseSearch.workplaceSearch.security.unsavedChanges.message',
353+
{
354+
defaultMessage:
355+
'Your private sources settings have not been saved. Are you sure you want to leave?',
356+
}
357+
);
358+
359+
export const PRIVATE_SOURCES_UPDATE_CONFIRMATION_TEXT = i18n.translate(
360+
'xpack.enterpriseSearch.workplaceSearch.security.privateSourcesUpdateConfirmation.text',
361+
{
362+
defaultMessage: 'Updates to private source configuration will take effect immediately.',
363+
}
364+
);
365+
366+
export const SOURCE_RESTRICTIONS_SUCCESS_MESSAGE = i18n.translate(
367+
'xpack.enterpriseSearch.workplaceSearch.security.sourceRestrictionsSuccess.message',
368+
{
369+
defaultMessage: 'Successfully updated source restrictions.',
370+
}
371+
);
372+
292373
export const PUBLIC_KEY_LABEL = i18n.translate(
293374
'xpack.enterpriseSearch.workplaceSearch.publicKey.label',
294375
{
@@ -382,6 +463,20 @@ export const SAVE_CHANGES_BUTTON = i18n.translate(
382463
}
383464
);
384465

466+
export const SAVE_SETTINGS_BUTTON = i18n.translate(
467+
'xpack.enterpriseSearch.workplaceSearch.saveSettings.button',
468+
{
469+
defaultMessage: 'Save settings',
470+
}
471+
);
472+
473+
export const KEEP_EDITING_BUTTON = i18n.translate(
474+
'xpack.enterpriseSearch.workplaceSearch.keepEditing.button',
475+
{
476+
defaultMessage: 'Keep editing',
477+
}
478+
);
479+
385480
export const NAME_LABEL = i18n.translate('xpack.enterpriseSearch.workplaceSearch.name.label', {
386481
defaultMessage: 'Name',
387482
});
@@ -493,6 +588,10 @@ export const UPDATE_BUTTON = i18n.translate(
493588
}
494589
);
495590

591+
export const RESET_BUTTON = i18n.translate('xpack.enterpriseSearch.workplaceSearch.reset.button', {
592+
defaultMessage: 'Reset',
593+
});
594+
496595
export const CONFIGURE_BUTTON = i18n.translate(
497596
'xpack.enterpriseSearch.workplaceSearch.configure.button',
498597
{
@@ -522,13 +621,31 @@ export const PRIVATE_PLATINUM_LICENSE_CALLOUT = i18n.translate(
522621
}
523622
);
524623

624+
export const SOURCE = i18n.translate('xpack.enterpriseSearch.workplaceSearch.source.text', {
625+
defaultMessage: 'Source',
626+
});
627+
525628
export const PRIVATE_SOURCE = i18n.translate(
526629
'xpack.enterpriseSearch.workplaceSearch.privateSource.text',
527630
{
528631
defaultMessage: 'Private Source',
529632
}
530633
);
531634

635+
export const PRIVATE_SOURCES = i18n.translate(
636+
'xpack.enterpriseSearch.workplaceSearch.privateSources.text',
637+
{
638+
defaultMessage: 'Private Sources',
639+
}
640+
);
641+
642+
export const CONFIRM_CHANGES_TEXT = i18n.translate(
643+
'xpack.enterpriseSearch.workplaceSearch.confirmChanges.text',
644+
{
645+
defaultMessage: 'Confirm changes',
646+
}
647+
);
648+
532649
export const CONNECTORS_HEADER_TITLE = i18n.translate(
533650
'xpack.enterpriseSearch.workplaceSearch.connectors.header.title',
534651
{

0 commit comments

Comments
 (0)