Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
Bamieh committed Dec 13, 2019
2 parents 2538296 + 6c1f248 commit 4fa94f3
Show file tree
Hide file tree
Showing 112 changed files with 4,997 additions and 1,028 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ module.exports = {
allowSameFolder: true,
},
{
target: ['src/core/**/*'],
target: ['src/**/*'],
from: ['x-pack/**/*'],
errorMessage: 'OSS cannot import x-pack files.',
},
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/pr-project-assigner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
pull_request:
types: [labeled, unlabeled]

jobs:
assign_to_project:
runs-on: ubuntu-latest
name: Assign a PR to project based on label
steps:
- name: Assign to project
uses: elastic/github-actions/project-assigner@v1.0.0
id: project_assigner
with:
issue-mappings: '[{"label": "Team:AppAch", "projectName": "kibana-app-arch", "columnId": 6173897}]'
ghToken: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/project-assigner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
issues:
types: [labeled, unlabeled]

jobs:
assign_to_project:
runs-on: ubuntu-latest
name: Assign issue or PR to project based on label
steps:
- name: Assign to project
uses: elastic/github-actions/project-assigner@v1.0.0
id: project_assigner
with:
issue-mappings: '[{"label": "Team:AppArch", "projectName": "kibana-app-arch", "columnId": 6173895}]'
ghToken: ${{ secrets.GITHUB_TOKEN }}


Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Wait timed out after 10055ms
at onFailure (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:68:13)]]>
</failure>
</testcase>
<testcase name="maps app &quot;after all&quot; hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179">
<testcase name="maps app &quot;after all&quot; hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179" metadata-json="{&quot;messages&quot;:[&quot;foo&quot;],&quot;screenshots&quot;:[{&quot;name&quot;:&quot;failure[dashboard app using current data dashboard snapshots compare TSVB snapshot]&quot;,&quot;url&quot;:&quot;https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png&quot;}]}">
<system-out>
<![CDATA[[00:00:00] │
[00:07:04] └-: maps app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ it('rewrites ftr reports with minimal changes', async () => {
+ at onFailure (/var/lib/jenkins/workspace/elastic+kibana+master/JOB/x-pack-ciGroup7/node/immutable/kibana/test/common/services/retry/retry_for_success.ts:68:13)
‹/failure›
‹/testcase›
‹testcase name="maps app &quot;after all&quot; hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179"›
‹testcase name="maps app &quot;after all&quot; hook" classname="Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps" time="0.179" metadata-json="{&quot;messages&quot;:[&quot;foo&quot;],&quot;screenshots&quot;:[{&quot;name&quot;:&quot;failure[dashboard app using current data dashboard snapshots compare TSVB snapshot]&quot;,&quot;url&quot;:&quot;https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png&quot;}]}"
‹system-out›
- ‹![CDATA[[00:00:00] │
+ [00:00:00] │
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ it('discovers failures in ftr report', async () => {
at process._tickCallback (internal/process/next_tick.js:68:7) name: 'NoSuchSessionError', remoteStacktrace: '' }
",
"likelyIrrelevant": true,
"metadata-json": "{\\"messages\\":[\\"foo\\"],\\"screenshots\\":[{\\"name\\":\\"failure[dashboard app using current data dashboard snapshots compare TSVB snapshot]\\",\\"url\\":\\"https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png\\"}]}",
"name": "maps app \\"after all\\" hook",
"time": "0.179",
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { getReportMessageIter } from './report_metadata';
import { parseTestReport } from './test_report';
import { FTR_REPORT, JEST_REPORT, KARMA_REPORT, MOCHA_REPORT } from './__fixtures__';

it('reads messages and screenshots from metadata-json properties', async () => {
const ftrReport = await parseTestReport(FTR_REPORT);
expect(Array.from(getReportMessageIter(ftrReport))).toMatchInlineSnapshot(`
Array [
Object {
"classname": "Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps",
"message": "foo",
"name": "maps app \\"after all\\" hook",
},
Object {
"classname": "Chrome X-Pack UI Functional Tests.x-pack/test/functional/apps/maps",
"message": "Screenshot: failure[dashboard app using current data dashboard snapshots compare TSVB snapshot] https://storage.googleapis.com/kibana-ci-artifacts/jobs/elastic+kibana+7.x/1632/kibana-oss-tests/test/functional/screenshots/failure/dashboard%20app%20using%20current%20data%20dashboard%20snapshots%20compare%20TSVB%20snapshot.png",
"name": "maps app \\"after all\\" hook",
},
]
`);

const jestReport = await parseTestReport(JEST_REPORT);
expect(Array.from(getReportMessageIter(jestReport))).toMatchInlineSnapshot(`Array []`);

const mochaReport = await parseTestReport(MOCHA_REPORT);
expect(Array.from(getReportMessageIter(mochaReport))).toMatchInlineSnapshot(`Array []`);

const karmaReport = await parseTestReport(KARMA_REPORT);
expect(Array.from(getReportMessageIter(karmaReport))).toMatchInlineSnapshot(`Array []`);
});
25 changes: 7 additions & 18 deletions packages/kbn-test/src/failed_tests_reporter/report_metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,25 @@
*/

import { TestReport, makeTestCaseIter } from './test_report';
import { Message } from './add_messages_to_report';

export function* getMetadataIter(report: TestReport) {
export function* getReportMessageIter(report: TestReport) {
for (const testCase of makeTestCaseIter(report)) {
if (!testCase.$['metadata-json']) {
yield [{}, testCase];
} else {
yield [{}, JSON.parse(testCase.$['metadata-json'])];
}
}
}
const metadata = testCase.$['metadata-json'] ? JSON.parse(testCase.$['metadata-json']) : {};

export function getReportMessages(report: TestReport) {
const messages: Message[] = [];
for (const [metadata, testCase] of getMetadataIter(report)) {
for (const message of metadata.messages || []) {
messages.push({
yield {
classname: testCase.$.classname,
name: testCase.$.name,
message,
});
message: String(message),
};
}

for (const screenshot of metadata.screenshots || []) {
messages.push({
yield {
classname: testCase.$.classname,
name: testCase.$.name,
message: `Screenshot: ${screenshot.name} ${screenshot.url}`,
});
};
}
}
return messages;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { updateFailureIssue, createFailureIssue } from './report_failure';
import { getIssueMetadata } from './issue_metadata';
import { readTestReport } from './test_report';
import { addMessagesToReport } from './add_messages_to_report';
import { getReportMessages } from './report_metadata';
import { getReportMessageIter } from './report_metadata';

export function runFailedTestsReporterCli() {
run(
Expand Down Expand Up @@ -75,7 +75,7 @@ export function runFailedTestsReporterCli() {

for (const reportPath of reportPaths) {
const report = await readTestReport(reportPath);
const messages = getReportMessages(report);
const messages = Array.from(getReportMessageIter(report));

for (const failure of await getFailures(report)) {
const pushMessage = (msg: string) => {
Expand Down
2 changes: 0 additions & 2 deletions src/legacy/ui/public/new_platform/new_platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { KibanaLegacySetup, KibanaLegacyStart } from '../../../../plugins/kibana
import { HomePublicPluginSetup, HomePublicPluginStart } from '../../../../plugins/home/public';
import { SharePluginSetup, SharePluginStart } from '../../../../plugins/share/public';
import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public';
import { LicensingPluginSetup } from '../../../../../x-pack/plugins/licensing/common/types';

export interface PluginsSetup {
data: ReturnType<DataPlugin['setup']>;
Expand All @@ -46,7 +45,6 @@ export interface PluginsSetup {
kibana_legacy: KibanaLegacySetup;
share: SharePluginSetup;
usageCollection: UsageCollectionSetup;
licensing: LicensingPluginSetup;
}

export interface PluginsStart {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/legacy/common/poller.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ export declare class Poller {
constructor(options: any);

public start(): void;
public stop(): void;
public isRunning(): boolean;
public getPollFrequency(): number;
}
24 changes: 0 additions & 24 deletions x-pack/legacy/plugins/actions/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,30 +69,6 @@ export class Plugin {
this.adminClient = await core.elasticsearch.adminClient$.pipe(first()).toPromise();
this.defaultKibanaIndex = (await this.kibana$.pipe(first()).toPromise()).index;

plugins.xpack_main.registerFeature({
id: 'actions',
name: 'Actions',
app: ['actions', 'kibana'],
privileges: {
all: {
savedObject: {
all: ['action', 'action_task_params'],
read: [],
},
ui: [],
api: ['actions-read', 'actions-all'],
},
read: {
savedObject: {
all: ['action_task_params'],
read: ['action'],
},
ui: [],
api: ['actions-read'],
},
},
});

// Encrypted attributes
// - `secrets` properties will be encrypted
// - `config` will be included in AAD
Expand Down
24 changes: 0 additions & 24 deletions x-pack/legacy/plugins/alerting/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,6 @@ export class Plugin {
): Promise<PluginSetupContract> {
this.adminClient = await core.elasticsearch.adminClient$.pipe(first()).toPromise();

plugins.xpack_main.registerFeature({
id: 'alerting',
name: 'Alerting',
app: ['alerting', 'kibana'],
privileges: {
all: {
savedObject: {
all: ['alert'],
read: [],
},
ui: [],
api: ['alerting-read', 'alerting-all'],
},
read: {
savedObject: {
all: [],
read: ['alert'],
},
ui: [],
api: ['alerting-read'],
},
},
});

// Encrypted attributes
plugins.encryptedSavedObjects.registerType({
type: 'alert',
Expand Down
7 changes: 6 additions & 1 deletion x-pack/legacy/plugins/graph/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_regis
import { npSetup, npStart } from 'ui/new_platform';
import { Storage } from '../../../../../src/plugins/kibana_utils/public';
import { start as navigation } from '../../../../../src/legacy/core_plugins/navigation/public/legacy';
import { LicensingPluginSetup } from '../../../../plugins/licensing/public';
import { GraphPlugin } from './plugin';

// @ts-ignore
Expand All @@ -39,13 +40,17 @@ async function getAngularInjectedDependencies(): Promise<LegacyAngularInjectedDe
};
}

type XpackNpSetupDeps = typeof npSetup.plugins & {
licensing: LicensingPluginSetup;
};

(async () => {
const instance = new GraphPlugin();
instance.setup(npSetup.core, {
__LEGACY: {
Storage,
},
...npSetup.plugins,
...(npSetup.plugins as XpackNpSetupDeps),
});
instance.start(npStart.core, {
npData: npStart.plugins.data,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/graph/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { CoreSetup, CoreStart, Plugin, SavedObjectsClientContract } from 'src/co
import { Plugin as DataPlugin } from 'src/plugins/data/public';
import { LegacyAngularInjectedDependencies } from './render_app';
import { NavigationStart } from '../../../../../src/legacy/core_plugins/navigation/public';
import { LicensingPluginSetup } from '../../../../plugins/licensing/common/types';
import { LicensingPluginSetup } from '../../../../plugins/licensing/public';

export interface GraphPluginStartDependencies {
npData: ReturnType<DataPlugin['start']>;
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/graph/public/render_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
IndexPatternsContract,
} from '../../../../../src/plugins/data/public';
import { NavigationStart } from '../../../../../src/legacy/core_plugins/navigation/public';
import { LicensingPluginSetup } from '../../../../plugins/licensing/common/types';
import { LicensingPluginSetup } from '../../../../plugins/licensing/public';
import { checkLicense } from '../../../../plugins/graph/common/check_license';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ export const InnerIndexPatternDataPanel = function InnerIndexPatternDataPanel({
'data-test-subj': 'indexPattern-switch-link',
className: 'lnsInnerIndexPatternDataPanel__triggerButton',
}}
indexPatternId={currentIndexPatternId}
indexPatternRefs={indexPatternRefs}
onChangeIndexPattern={(newId: string) => {
onChangeIndexPattern(newId);
Expand Down
15 changes: 11 additions & 4 deletions x-pack/legacy/plugins/siem/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,24 @@ export class Plugin {
catalogue: ['siem'],
privileges: {
all: {
api: ['siem'],
api: ['siem', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
savedObject: {
all: [noteSavedObjectType, pinnedEventSavedObjectType, timelineSavedObjectType],
all: [
'alert',
'action',
'action_task_params',
noteSavedObjectType,
pinnedEventSavedObjectType,
timelineSavedObjectType,
],
read: ['config'],
},
ui: ['show'],
},
read: {
api: ['siem'],
api: ['siem', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
savedObject: {
all: [],
all: ['alert', 'action', 'action_task_params'],
read: [
'config',
noteSavedObjectType,
Expand Down
27 changes: 27 additions & 0 deletions x-pack/legacy/plugins/uptime/common/runtime_types/common.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import * as t from 'io-ts';

export const LocationType = t.partial({
lat: t.string,
lon: t.string,
});

export const CheckGeoType = t.partial({
name: t.string,
location: LocationType,
});

export const SummaryType = t.partial({
up: t.number,
down: t.number,
geo: CheckGeoType,
});

export type Summary = t.TypeOf<typeof SummaryType>;
export type CheckGeo = t.TypeOf<typeof CheckGeoType>;
export type Location = t.TypeOf<typeof LocationType>;
2 changes: 2 additions & 0 deletions x-pack/legacy/plugins/uptime/common/runtime_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

export * from './common';
export * from './snapshot';
export * from './monitor/monitor_details';
export * from './monitor/monitor_locations';
Loading

0 comments on commit 4fa94f3

Please sign in to comment.