Skip to content

Commit

Permalink
Merge branch 'main' into eui/61.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Aug 9, 2022
2 parents d279fd6 + aa1ce83 commit 4694139
Show file tree
Hide file tree
Showing 70 changed files with 911 additions and 829 deletions.
12 changes: 7 additions & 5 deletions .buildkite/pipeline-utils/ci-stats/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ export class CiStatsClient {
jenkinsJobId: process.env.BUILDKITE_BUILD_NUMBER,
jenkinsUrl: process.env.BUILDKITE_BUILD_URL,
prId: process.env.GITHUB_PR_NUMBER || null,
backfillJobIds: process.env.KIBANA_REUSABLE_BUILD_JOB_ID
? [process.env.KIBANA_REUSABLE_BUILD_JOB_ID]
: [],
},
});

Expand Down Expand Up @@ -132,13 +135,12 @@ export class CiStatsClient {
});
};

getPrReport = async (buildId: string, backfillJobIds: string[] = []) => {
getPrReport = async (buildId: string) => {
const resp = await this.request<CiStatsPrReport>({
path: `v3/pr_report`,
method: 'post',
body: {
method: 'GET',
path: `v2/pr_report`,
params: {
buildId,
backfillJobIds,
},
});

Expand Down
7 changes: 1 addition & 6 deletions .buildkite/pipeline-utils/ci-stats/on_complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ export async function onComplete() {
return;
}

const backfillJobIds: string[] = [];
if (process.env.KIBANA_REUSABLE_BUILD_JOB_ID) {
backfillJobIds.push(process.env.KIBANA_REUSABLE_BUILD_JOB_ID);
}

const report = await ciStats.getPrReport(process.env.CI_STATS_BUILD_ID, backfillJobIds);
const report = await ciStats.getPrReport(process.env.CI_STATS_BUILD_ID);
if (report?.md) {
buildkite.setMetadata('pr_comment:ci_stats_report:body', report.md);

Expand Down
35 changes: 24 additions & 11 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,30 @@ steps:
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"
timeout_in_minutes: 60

- command: .buildkite/scripts/steps/build_api_docs.sh
label: 'Build API Docs'
agents:
queue: n2-4-spot
key: build_api_docs
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3

- command: .buildkite/scripts/steps/ci_stats_ready.sh
label: Mark CI Stats as ready
agents:
queue: kibana-default
timeout_in_minutes: 10
depends_on:
- build
- build_api_docs
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/test/pick_test_group_run_order.sh
label: 'Pick Test Group Run Order'
agents:
Expand Down Expand Up @@ -61,14 +85,3 @@ steps:
agents:
queue: c2-8
timeout_in_minutes: 60

- command: .buildkite/scripts/steps/build_api_docs.sh
label: 'Build API Docs'
agents:
queue: n2-4-spot
key: build_api_docs
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ export function DataViewPicker({
{...selectableProps}
searchable
singleSelection="always"
options={dataViews.map(({ title, id }) => ({
options={dataViews.map(({ name, id, title }) => ({
key: id,
label: title,
label: name ?? title,
value: id,
'data-test-subj': `data-view-picker-${title}`,
'data-test-subj': `data-view-picker-${name ?? title}`,
checked: id === selectedDataViewId ? 'on' : undefined,
}))}
onChange={(choices) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Expand-Archive .\elastic-agent-${kibanaVersion}-windows-x86_64.zip -DestinationP
cd elastic-agent-${kibanaVersion}-windows-x86_64
.\\elastic-agent.exe install`;

const k8sCommand = 'kubectl apply -f elastic-agent-standalone-kubernetes.yaml';
const k8sCommand = 'kubectl apply -f elastic-agent-standalone-kubernetes.yml';

return {
linux: linuxCommand,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export const LOADING_ENDPOINT_DATA_TOOLTIP = i18n.translate(
'xpack.securitySolution.endpoint.detections.takeAction.responseActionConsole.loadingTooltip',
{ defaultMessage: 'Loading' }
);
export const METADATA_API_ERROR_TOOLTIP = i18n.translate(
'xpack.securitySolution.endpoint.detections.takeAction.responseActionConsole.generalMetadataErrorTooltip',
{ defaultMessage: 'Failed to retrieve Endpoint metadata' }
);

export interface ResponderContextMenuItemProps {
endpointId: string;
Expand Down Expand Up @@ -62,16 +66,21 @@ export const ResponderContextMenuItem = memo<ResponderContextMenuItemProps>(
return [true, LOADING_ENDPOINT_DATA_TOOLTIP];
}

// if we got an error and it's a 400 (alerts can exist for endpoint that are no longer around)
// if we got an error and it's a 400 with unenrolled in the error message (alerts can exist for endpoint that are no longer around)
// or,
// the Host status is `unenrolled`
if (
(error && error.body?.statusCode === 400) ||
(error && error.body?.statusCode === 400 && error.body?.message.includes('unenrolled')) ||
endpointHostInfo?.host_status === HostStatus.UNENROLLED
) {
return [true, HOST_ENDPOINT_UNENROLLED_TOOLTIP];
}

// return general error tooltip
if (error) {
return [true, METADATA_API_ERROR_TOOLTIP];
}

return [false, undefined];
}, [endpointHostInfo, endpointId, error, isFetching, isResponderCapabilitiesEnabled]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ export const PreviewHistogram = ({
() => (advancedOptions ? advancedOptions.timeframeEnd.toISOString() : formatDate(to)),
[to, advancedOptions]
);
const alertsEndDate = useMemo(() => formatDate(to), [to]);
const isEqlRule = useMemo(() => ruleType === 'eql', [ruleType]);
const isMlRule = useMemo(() => ruleType === 'machine_learning', [ruleType]);

Expand Down Expand Up @@ -214,7 +213,12 @@ export const PreviewHistogram = ({
dataProviders,
deletedEventIds,
disabledCellActions: FIELDS_WITHOUT_CELL_ACTIONS,
end: alertsEndDate,
// Fix for https://github.com/elastic/kibana/issues/135511, until we start writing proper
// simulated @timestamp values to the preview alerts. The preview alerts will have @timestamp values
// close to the server's `now` time, but the client clock could be out of sync with the server. So we
// avoid computing static dates for this time range filter and instead pass in a small relative time window.
end: 'now+5m',
start: 'now-5m',
entityType: 'events',
filters: [],
globalFullScreen,
Expand All @@ -233,7 +237,6 @@ export const PreviewHistogram = ({
runtimeMappings,
setQuery: () => {},
sort,
start: startDate,
tGridEventRenderedViewEnabled,
type: 'embedded',
leadingControlColumns: getPreviewTableControlColumn(1.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { initialUserPrivilegesState as mockInitialUserPrivilegesState } from '..
import { useUserPrivileges } from '../../../common/components/user_privileges';
import { useIsExperimentalFeatureEnabled } from '../../../common/hooks/use_experimental_features';
import {
HOST_ENDPOINT_UNENROLLED_TOOLTIP,
NOT_FROM_ENDPOINT_HOST_TOOLTIP,
HOST_ENDPOINT_UNENROLLED_TOOLTIP,
} from '../endpoint_responder/responder_context_menu_item';
import { endpointMetadataHttpMocks } from '../../../management/pages/endpoint_hosts/mocks';
import type { HttpSetup } from '@kbn/core/public';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { HOST_METADATA_GET_ROUTE } from '../../../../common/endpoint/constants';

interface HttpResponse {
statusCode: number;
message: string;
}

/**
Expand Down
20 changes: 10 additions & 10 deletions x-pack/plugins/watcher/__jest__/client_integration/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
* 2.0.
*/

import { setup as watchListSetup } from './watch_list.helpers';
import { setup as watchStatusSetup } from './watch_status.helpers';
import { setup as watchCreateJsonSetup } from './watch_create_json.helpers';
import { setup as watchCreateThresholdSetup } from './watch_create_threshold.helpers';
import { setup as watchEditSetup } from './watch_edit.helpers';
import { setup as watchListPageSetup } from './watch_list_page.helpers';
import { setup as watchStatusPageSetup } from './watch_status_page.helpers';
import { setup as watchCreateJsonPageSetup } from './watch_create_json_page.helpers';
import { setup as watchCreateThresholdPageSetup } from './watch_create_threshold_page.helpers';
import { setup as watchEditPageSetup } from './watch_edit_page.helpers';

export type { TestBed } from '@kbn/test-jest-helpers';
export { getRandomString, findTestSubject } from '@kbn/test-jest-helpers';
export { setupEnvironment } from './setup_environment';

export const pageHelpers = {
watchList: { setup: watchListSetup },
watchStatus: { setup: watchStatusSetup },
watchCreateJson: { setup: watchCreateJsonSetup },
watchCreateThreshold: { setup: watchCreateThresholdSetup },
watchEdit: { setup: watchEditSetup },
watchListPage: { setup: watchListPageSetup },
watchStatusPage: { setup: watchStatusPageSetup },
watchCreateJsonPage: { setup: watchCreateJsonPageSetup },
watchCreateThresholdPage: { setup: watchCreateThresholdPageSetup },
watchEditPage: { setup: watchEditPageSetup },
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers';
import { HttpSetup } from '@kbn/core/public';

import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit';
import { WatchEditPage } from '../../../public/application/sections/watch_edit_page';
import { registerRouter } from '../../../public/application/lib/navigation';
import { ROUTES, WATCH_TYPES } from '../../../common/constants';
import { WithAppDependencies } from './setup_environment';
Expand All @@ -31,7 +31,7 @@ export interface WatchCreateJsonTestBed extends TestBed<WatchCreateJsonTestSubje
}

export const setup = async (httpSetup: HttpSetup): Promise<WatchCreateJsonTestBed> => {
const initTestBed = registerTestBed(WithAppDependencies(WatchEdit, httpSetup), testBedConfig);
const initTestBed = registerTestBed(WithAppDependencies(WatchEditPage, httpSetup), testBedConfig);
const testBed = await initTestBed();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers';
import { HttpSetup } from '@kbn/core/public';

import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit';
import { WatchEditPage } from '../../../public/application/sections/watch_edit_page';
import { registerRouter } from '../../../public/application/lib/navigation';
import { ROUTES, WATCH_TYPES } from '../../../common/constants';
import { WithAppDependencies } from './setup_environment';
Expand All @@ -34,7 +34,7 @@ export interface WatchCreateThresholdTestBed extends TestBed<WatchCreateThreshol
}

export const setup = async (httpSetup: HttpSetup): Promise<WatchCreateThresholdTestBed> => {
const initTestBed = registerTestBed(WithAppDependencies(WatchEdit, httpSetup), testBedConfig);
const initTestBed = registerTestBed(WithAppDependencies(WatchEditPage, httpSetup), testBedConfig);
const testBed = await initTestBed();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { registerTestBed, TestBed, AsyncTestBedConfig } from '@kbn/test-jest-helpers';
import { HttpSetup } from '@kbn/core/public';

import { WatchEdit } from '../../../public/application/sections/watch_edit/components/watch_edit';
import { WatchEditPage } from '../../../public/application/sections/watch_edit_page';
import { registerRouter } from '../../../public/application/lib/navigation';
import { ROUTES } from '../../../common/constants';
import { WATCH_ID } from './jest_constants';
Expand All @@ -30,7 +30,7 @@ export interface WatchEditTestBed extends TestBed<WatchEditSubjects> {
}

export const setup = async (httpSetup: HttpSetup): Promise<WatchEditTestBed> => {
const initTestBed = registerTestBed(WithAppDependencies(WatchEdit, httpSetup), testBedConfig);
const initTestBed = registerTestBed(WithAppDependencies(WatchEditPage, httpSetup), testBedConfig);
const testBed = await initTestBed();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
AsyncTestBedConfig,
} from '@kbn/test-jest-helpers';
import { HttpSetup } from '@kbn/core/public';
import { WatchList } from '../../../public/application/sections/watch_list/components/watch_list';
import { WatchListPage } from '../../../public/application/sections/watch_list_page';
import { ROUTES, REFRESH_INTERVALS } from '../../../common/constants';
import { WithAppDependencies } from './setup_environment';

Expand All @@ -35,7 +35,7 @@ export interface WatchListTestBed extends TestBed<WatchListTestSubjects> {
}

export const setup = async (httpSetup: HttpSetup): Promise<WatchListTestBed> => {
const initTestBed = registerTestBed(WithAppDependencies(WatchList, httpSetup), testBedConfig);
const initTestBed = registerTestBed(WithAppDependencies(WatchListPage, httpSetup), testBedConfig);
const testBed = await initTestBed();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import { HttpSetup } from '@kbn/core/public';

import { registerRouter } from '../../../public/application/lib/navigation';
import { WatchStatus } from '../../../public/application/sections/watch_status/components/watch_status';
import { WatchStatusPage } from '../../../public/application/sections/watch_status_page';
import { ROUTES } from '../../../common/constants';
import { WATCH_ID } from './jest_constants';
import { WithAppDependencies } from './setup_environment';
Expand All @@ -41,7 +41,10 @@ export interface WatchStatusTestBed extends TestBed<WatchStatusTestSubjects> {
}

export const setup = async (httpSetup: HttpSetup): Promise<WatchStatusTestBed> => {
const initTestBed = registerTestBed(WithAppDependencies(WatchStatus, httpSetup), testBedConfig);
const initTestBed = registerTestBed(
WithAppDependencies(WatchStatusPage, httpSetup),
testBedConfig
);
const testBed = await initTestBed();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import { getExecuteDetails } from '../../__fixtures__';
import { API_BASE_PATH } from '../../common/constants';
import { defaultWatch } from '../../public/application/models/watch';
import { setupEnvironment, pageHelpers } from './helpers';
import { WatchCreateJsonTestBed } from './helpers/watch_create_json.helpers';
import type { WatchCreateJsonTestBed } from './helpers/watch_create_json_page.helpers';
import { WATCH } from './helpers/jest_constants';

const { setup } = pageHelpers.watchCreateJson;
const { setup } = pageHelpers.watchCreateJsonPage;

describe('<JsonWatchEdit /> create route', () => {
describe('<JsonWatchEditPage /> create route', () => {
const { httpSetup, httpRequestsMockHelpers } = setupEnvironment();
let testBed: WatchCreateJsonTestBed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { WATCH_ID } from './helpers/jest_constants';
import { getExecuteDetails } from '../../__fixtures__';
import { WATCH_TYPES, API_BASE_PATH } from '../../common/constants';
import { setupEnvironment, pageHelpers } from './helpers';
import { WatchCreateThresholdTestBed } from './helpers/watch_create_threshold.helpers';
import type { WatchCreateThresholdTestBed } from './helpers/watch_create_threshold_page.helpers';

const WATCH_NAME = 'my_test_watch';

Expand Down Expand Up @@ -77,9 +77,9 @@ jest.mock('@elastic/eui', () => {
};
});

const { setup } = pageHelpers.watchCreateThreshold;
const { setup } = pageHelpers.watchCreateThresholdPage;

describe('<ThresholdWatchEdit /> create route', () => {
describe('<ThresholdWatchEditPage /> create route', () => {
const { httpSetup, httpRequestsMockHelpers } = setupEnvironment();
let testBed: WatchCreateThresholdTestBed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { act } from 'react-dom/test-utils';
import { getWatch } from '../../__fixtures__';
import { defaultWatch } from '../../public/application/models/watch';
import { setupEnvironment, pageHelpers } from './helpers';
import { WatchEditTestBed } from './helpers/watch_edit.helpers';
import type { WatchEditTestBed } from './helpers/watch_edit_page.helpers';
import { WATCH, WATCH_ID } from './helpers/jest_constants';
import { API_BASE_PATH } from '../../common/constants';

const { setup } = pageHelpers.watchEdit;
const { setup } = pageHelpers.watchEditPage;

describe('<WatchEdit />', () => {
describe('<WatchEditPage />', () => {
const { httpSetup, httpRequestsMockHelpers } = setupEnvironment();
let testBed: WatchEditTestBed;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import { act } from 'react-dom/test-utils';
import * as fixtures from '../../__fixtures__';
import { setupEnvironment, pageHelpers, getRandomString, findTestSubject } from './helpers';
import { WatchListTestBed } from './helpers/watch_list.helpers';
import type { WatchListTestBed } from './helpers/watch_list_page.helpers';
import { API_BASE_PATH } from '../../common/constants';

const { setup } = pageHelpers.watchList;
const { setup } = pageHelpers.watchListPage;

describe('<WatchList />', () => {
describe('<WatchListPage />', () => {
const { httpSetup, httpRequestsMockHelpers } = setupEnvironment();
let testBed: WatchListTestBed;

Expand Down
Loading

0 comments on commit 4694139

Please sign in to comment.