Skip to content

Commit

Permalink
Merge branch 'main' into settings-links
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Jan 10, 2022
2 parents a33fe8c + 1b971c9 commit 1c3e0ec
Show file tree
Hide file tree
Showing 64 changed files with 618 additions and 1,490 deletions.
27 changes: 27 additions & 0 deletions .buildkite/pipelines/package_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
steps:
- command: .buildkite/scripts/steps/package_testing/build.sh
label: Build Packages
agents:
queue: c2-16
timeout_in_minutes: 60
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"

- wait

- command: TEST_PACKAGE=deb .buildkite/scripts/steps/package_testing/test.sh
label: Package testing for deb
agents:
queue: n2-4-virt
timeout_in_minutes: 60

- command: TEST_PACKAGE=rpm .buildkite/scripts/steps/package_testing/test.sh
label: Package testing for rpm
agents:
queue: n2-4-virt
timeout_in_minutes: 60

- command: TEST_PACKAGE=docker .buildkite/scripts/steps/package_testing/test.sh
label: Package testing for docker
agents:
queue: n2-4-virt
timeout_in_minutes: 60
12 changes: 12 additions & 0 deletions .buildkite/scripts/steps/package_testing/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

set -euo pipefail

.buildkite/scripts/bootstrap.sh

echo "--- Build Kibana Distribution"
node scripts/build --all-platforms --debug

cd target
buildkite-agent artifact upload "./kibana-[0-9]*-docker-image.tar.gz;./*.deb;./*.rpm"
cd ..
39 changes: 39 additions & 0 deletions .buildkite/scripts/steps/package_testing/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

set -euo pipefail

.buildkite/scripts/bootstrap.sh

echo "--- Package Testing for $TEST_PACKAGE"

mkdir -p target
cd target
if [[ "$TEST_PACKAGE" == "deb" ]]; then
buildkite-agent artifact download 'kibana-*.deb' . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
KIBANA_IP_ADDRESS="192.168.50.5"
elif [[ "$TEST_PACKAGE" == "rpm" ]]; then
buildkite-agent artifact download 'kibana-*.rpm' . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
KIBANA_IP_ADDRESS="192.168.50.6"
elif [[ "$TEST_PACKAGE" == "docker" ]]; then
buildkite-agent artifact download 'kibana-*-docker-image.tar.gz' . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
KIBANA_IP_ADDRESS="192.168.50.7"
fi
cd ..

export VAGRANT_CWD=test/package
vagrant up "$TEST_PACKAGE" --no-provision

node scripts/es snapshot \
-E network.bind_host=127.0.0.1,192.168.50.1 \
-E discovery.type=single-node \
--license=trial &
while ! timeout 1 bash -c "echo > /dev/tcp/localhost/9200"; do sleep 30; done

vagrant provision "$TEST_PACKAGE"

export TEST_BROWSER_HEADLESS=1
export TEST_KIBANA_URL="http://elastic:changeme@$KIBANA_IP_ADDRESS:5601"
export TEST_ES_URL=http://elastic:changeme@192.168.50.1:9200

cd x-pack
node scripts/functional_test_runner.js --include-tag=smoke
13 changes: 7 additions & 6 deletions .buildkite/scripts/steps/storybooks/build_and_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ const path = require('path');
const STORYBOOKS = [
'apm',
'canvas',
'codeeditor',
'ci_composite',
'codeeditor',
'custom_integrations',
'url_template_editor',
'dashboard',
'dashboard_enhanced',
'dashboard',
'data_enhanced',
'embeddable',
'expression_error',
Expand All @@ -31,11 +30,13 @@ const STORYBOOKS = [
'expression_tagcloud',
'fleet',
'infra',
'security_solution',
'ui_actions_enhanced',
'lists',
'observability',
'presentation',
'lists',
'security_solution',
'shared_ux',
'ui_actions_enhanced',
'url_template_editor',
];

const GITHUB_CONTEXT = 'Build and Publish Storybooks';
Expand Down
26 changes: 1 addition & 25 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -339,32 +339,8 @@
#CC# /x-pack/plugins/stack_alerts @elastic/kibana-alerting-services

# Enterprise Search
# Shared
/x-pack/plugins/enterprise_search/* @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/common/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/public/* @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/public/applications/* @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/public/applications/enterprise_search/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/public/applications/shared/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/public/applications/__mocks__/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/* @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/lib/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/__mocks__/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/collectors/enterprise_search/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/collectors/lib/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/routes/enterprise_search/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search/server/saved_objects/enterprise_search/ @elastic/enterprise-search-frontend
/x-pack/plugins/enterprise_search @elastic/enterprise-search-frontend
/x-pack/test/functional_enterprise_search/ @elastic/enterprise-search-frontend
# App Search
/x-pack/plugins/enterprise_search/public/applications/app_search/ @elastic/app-search-frontend
/x-pack/plugins/enterprise_search/server/routes/app_search/ @elastic/app-search-frontend
/x-pack/plugins/enterprise_search/server/collectors/app_search/ @elastic/app-search-frontend
/x-pack/plugins/enterprise_search/server/saved_objects/app_search/ @elastic/app-search-frontend
# Workplace Search
/x-pack/plugins/enterprise_search/public/applications/workplace_search/ @elastic/workplace-search-frontend
/x-pack/plugins/enterprise_search/server/routes/workplace_search/ @elastic/workplace-search-frontend
/x-pack/plugins/enterprise_search/server/collectors/workplace_search/ @elastic/workplace-search-frontend
/x-pack/plugins/enterprise_search/server/saved_objects/workplace_search/ @elastic/workplace-search-frontend

# Management Experience - Deployment Management
/src/plugins/dev_tools/ @elastic/platform-deployment-management
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ jobs:
github_token: ${{secrets.KIBANAMACHINE_TOKEN}}
commit_user: kibanamachine
commit_email: 42973632+kibanamachine@users.noreply.github.com
auto_merge: 'true'
auto_merge_method: 'squash'
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
"constate": "^1.3.2",
"content-disposition": "0.5.3",
"copy-to-clipboard": "^3.0.8",
"core-js": "^3.20.1",
"core-js": "^3.20.2",
"cronstrue": "^1.51.0",
"cytoscape": "^3.10.0",
"cytoscape-dagre": "^2.2.2",
Expand Down Expand Up @@ -712,11 +712,11 @@
"babel-plugin-require-context-hook": "^1.0.0",
"babel-plugin-styled-components": "^2.0.2",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"backport": "^6.1.3",
"backport": "6.1.5",
"callsites": "^3.1.0",
"chai": "3.5.0",
"chance": "1.0.18",
"chromedriver": "^96.0.0",
"chromedriver": "^97.0.0",
"clean-webpack-plugin": "^3.0.0",
"cmd-shim": "^2.1.0",
"compression-webpack-plugin": "^4.0.0",
Expand Down Expand Up @@ -843,7 +843,7 @@
"rxjs-marbles": "^5.0.6",
"sass-loader": "^10.2.0",
"sass-resources-loader": "^2.0.1",
"selenium-webdriver": "^4.1.0",
"selenium-webdriver": "^4.1.1",
"serve-static": "1.14.1",
"shelljs": "^0.8.4",
"simple-git": "1.116.0",
Expand Down
37 changes: 23 additions & 14 deletions src/plugins/discover/public/embeddable/saved_search_grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { DiscoverGrid, DiscoverGridProps } from '../components/discover_grid/dis
import { getServices } from '../kibana_services';
import { TotalDocuments } from '../application/main/components/total_documents/total_documents';
import { ElasticSearchHit } from '../types';
import { KibanaContextProvider } from '../../../kibana_react/public';

export interface DiscoverGridEmbeddableProps extends DiscoverGridProps {
totalHitCount: number;
Expand All @@ -22,25 +23,33 @@ export const DataGridMemoized = React.memo((props: DiscoverGridProps) => (
));

export function DiscoverGridEmbeddable(props: DiscoverGridEmbeddableProps) {
const services = getServices();
const [expandedDoc, setExpandedDoc] = useState<ElasticSearchHit | undefined>(undefined);

return (
<I18nProvider>
<EuiFlexGroup style={{ width: '100%' }} direction="column" gutterSize="xs" responsive={false}>
{props.totalHitCount !== 0 && (
<EuiFlexItem grow={false} style={{ alignSelf: 'flex-end' }}>
<TotalDocuments totalHitCount={props.totalHitCount} />
<KibanaContextProvider services={services}>
<EuiFlexGroup
style={{ width: '100%' }}
direction="column"
gutterSize="xs"
responsive={false}
>
{props.totalHitCount !== 0 && (
<EuiFlexItem grow={false} style={{ alignSelf: 'flex-end' }}>
<TotalDocuments totalHitCount={props.totalHitCount} />
</EuiFlexItem>
)}
<EuiFlexItem style={{ minHeight: 0 }}>
<DataGridMemoized
{...props}
setExpandedDoc={setExpandedDoc}
expandedDoc={expandedDoc}
services={services}
/>
</EuiFlexItem>
)}
<EuiFlexItem style={{ minHeight: 0 }}>
<DataGridMemoized
{...props}
setExpandedDoc={setExpandedDoc}
expandedDoc={expandedDoc}
services={getServices()}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexGroup>
</KibanaContextProvider>
</I18nProvider>
);
}
54 changes: 53 additions & 1 deletion test/functional/apps/discover/_data_grid_doc_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kibanaServer = getService('kibanaServer');
const monacoEditor = getService('monacoEditor');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker']);
const dashboardAddPanel = getService('dashboardAddPanel');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'timePicker', 'dashboard']);
const defaultSettings = {
defaultIndex: 'logstash-*',
'doc_table:legacy': false,
Expand All @@ -32,6 +33,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await esArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional');
await kibanaServer.uiSettings.replace(defaultSettings);
await PageObjects.timePicker.setDefaultAbsoluteRangeViaUiSettings();
});

beforeEach(async () => {
await PageObjects.common.navigateToApp('discover');
});

Expand Down Expand Up @@ -101,6 +105,54 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
);
});

it('should show popover with expanded cell content by click on expand button on embeddable', async () => {
log.debug('open popover with expanded cell content to get json from the editor');
await PageObjects.timePicker.setDefaultAbsoluteRange();
await PageObjects.discover.waitUntilSearchingHasFinished();
await PageObjects.discover.saveSearch('expand-cell-search');

await PageObjects.common.navigateToApp('dashboard');
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await PageObjects.header.waitUntilLoadingHasFinished();
await dashboardAddPanel.addSavedSearch('expand-cell-search');

await retry.waitForWithTimeout('timestamp matches expected doc', 5000, async () => {
const cell = await dataGrid.getCellElement(0, 2);
const text = await cell.getVisibleText();
log.debug(`row document timestamp: ${text}`);
return text === 'Sep 22, 2015 @ 23:50:13.253';
});
const docCell = await dataGrid.getCellElement(0, 3);
await docCell.click();
const expandCellContentButton = await docCell.findByClassName(
'euiDataGridRowCell__expandButtonIcon'
);
await expandCellContentButton.click();

let expandDocId = '';

await retry.waitForWithTimeout('expandDocId to be valid', 5000, async () => {
const text = await monacoEditor.getCodeEditorValue();
return (expandDocId = JSON.parse(text)._id) === 'AU_x3_g4GFA8no6QjkYX';
});
log.debug(`expanded document id: ${expandDocId}`);

await dataGrid.clickRowToggle();
await find.clickByCssSelectorWhenNotDisabled('#kbn_doc_viewer_tab_1');

await retry.waitForWithTimeout(
'document id in flyout matching the expanded document id',
5000,
async () => {
const text = await monacoEditor.getCodeEditorValue();
const flyoutJson = JSON.parse(text);
log.debug(`flyout document id: ${flyoutJson._id}`);
return flyoutJson._id === expandDocId;
}
);
});

describe('expand a document row', function () {
const rowToInspect = 1;

Expand Down
2 changes: 1 addition & 1 deletion test/functional/services/data_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class DataGridService extends FtrService {
options: SelectOptions = { isAnchorRow: false, rowIndex: 0 }
): Promise<void> {
const row = await this.getRow(options);
const toggle = await row[0];
const toggle = await row[0].findByTestSubject('~docTableExpandToggleColumn');
await toggle.click();
}

Expand Down
32 changes: 32 additions & 0 deletions x-pack/plugins/alerting/server/saved_objects/migrations.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { RawRule } from '../types';
import { SavedObjectUnsanitizedDoc } from 'kibana/server';
import { encryptedSavedObjectsMock } from '../../../encrypted_saved_objects/server/mocks';
import { migrationMocks } from 'src/core/server/mocks';
import { RuleType, ruleTypeMappings } from '@kbn/securitysolution-rules';

const migrationContext = migrationMocks.createContext();
const encryptedSavedObjectsSetup = encryptedSavedObjectsMock.createSetup();
Expand Down Expand Up @@ -2056,6 +2057,37 @@ describe('successful migrations', () => {
);
});

test('doesnt change AAD rule params if not a siem.signals rule', () => {
const migration800 = getMigrations(encryptedSavedObjectsSetup, isPreconfigured)['8.0.0'];
const alert = getMockData(
{ params: { outputIndex: 'output-index', type: 'query' }, alertTypeId: 'not.siem.signals' },
true
);
expect(migration800(alert, migrationContext).attributes.alertTypeId).toEqual(
'not.siem.signals'
);
expect(migration800(alert, migrationContext).attributes.enabled).toEqual(true);
expect(migration800(alert, migrationContext).attributes.params.outputIndex).toEqual(
'output-index'
);
});

test.each(Object.keys(ruleTypeMappings) as RuleType[])(
'Changes AAD rule params accordingly if rule is a siem.signals %p rule',
(ruleType) => {
const migration800 = getMigrations(encryptedSavedObjectsSetup, isPreconfigured)['8.0.0'];
const alert = getMockData(
{ params: { outputIndex: 'output-index', type: ruleType }, alertTypeId: 'siem.signals' },
true
);
expect(migration800(alert, migrationContext).attributes.alertTypeId).toEqual(
ruleTypeMappings[ruleType]
);
expect(migration800(alert, migrationContext).attributes.enabled).toEqual(false);
expect(migration800(alert, migrationContext).attributes.params.outputIndex).toEqual('');
}
);

describe('Metrics Inventory Threshold rule', () => {
test('Migrates incorrect action group spelling', () => {
const migration800 = getMigrations(encryptedSavedObjectsSetup, isPreconfigured)['8.0.0'];
Expand Down
5 changes: 3 additions & 2 deletions x-pack/plugins/alerting/server/saved_objects/migrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function getMigrations(
(doc: SavedObjectUnsanitizedDoc<RawRule>): doc is SavedObjectUnsanitizedDoc<RawRule> => true,
pipeMigrations(
addThreatIndicatorPathToThreatMatchRules,
addRACRuleTypes,
addSecuritySolutionAADRuleTypes,
fixInventoryThresholdGroupId
)
);
Expand Down Expand Up @@ -652,7 +652,7 @@ function setLegacyId(doc: SavedObjectUnsanitizedDoc<RawRule>): SavedObjectUnsani
};
}

function addRACRuleTypes(
function addSecuritySolutionAADRuleTypes(
doc: SavedObjectUnsanitizedDoc<RawRule>
): SavedObjectUnsanitizedDoc<RawRule> {
const ruleType = doc.attributes.params.type;
Expand All @@ -662,6 +662,7 @@ function addRACRuleTypes(
attributes: {
...doc.attributes,
alertTypeId: ruleTypeMappings[ruleType],
enabled: false,
params: {
...doc.attributes.params,
outputIndex: '',
Expand Down
Loading

0 comments on commit 1c3e0ec

Please sign in to comment.