Skip to content

Commit

Permalink
Merge branch 'discover-popovers' of https://github.com/andreadelrio/k…
Browse files Browse the repository at this point in the history
…ibana into discover-popovers
  • Loading branch information
andreadelrio committed Aug 17, 2020
2 parents e1bbcdb + cb2a892 commit 26c46af
Show file tree
Hide file tree
Showing 121 changed files with 2,803 additions and 590 deletions.
21 changes: 21 additions & 0 deletions .ci/Jenkinsfile_security_cypress
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/groovy

library 'kibana-pipeline-library'
kibanaLibrary.load()

kibanaPipeline(timeoutMinutes: 180) {
slackNotifications.onFailure(
disabled: !params.NOTIFY_ON_FAILURE,
channel: '#security-solution-slack-testing'
) {
catchError {
workers.base(size: 's', ramDisk: false) {
kibanaPipeline.bash('test/scripts/jenkins_security_solution_cypress.sh', 'Execute Security Solution Cypress Tests')
}
}
}

if (params.NOTIFY_ON_FAILURE) {
kibanaPipeline.sendMail(to: 'gloria.delatorre@elastic.co')
}
}
5 changes: 0 additions & 5 deletions src/cli/serve/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ function applyConfigOverrides(rawConfig, opts, extraCliOptions) {
if (opts.verbose) set('logging.verbose', true);
if (opts.logFile) set('logging.dest', opts.logFile);

if (opts.optimize) {
set('server.autoListen', false);
set('plugins.initialize', false);
}

set('plugins.scanDirs', _.compact([].concat(get('plugins.scanDirs'), opts.pluginDir)));
set(
'plugins.paths',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@
# Description: Kibana
### END INIT INFO

#
# Source function libraries if present.
# (It improves integration with systemd)
#
# Red Hat
if [ -f /etc/rc.d/init.d/functions ]; then
. /etc/rc.d/init.d/functions

# Debian
elif [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions

# SUSE
elif [ -f /etc/rc.status ]; then
. /etc/rc.status
rc_reset
fi

name=kibana
program=/usr/share/kibana/bin/kibana
pidfile="/var/run/kibana/$name.pid"
Expand Down
1 change: 1 addition & 0 deletions src/dev/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default {
setupFilesAfterEnv: [
'<rootDir>/src/dev/jest/setup/mocks.js',
'<rootDir>/src/dev/jest/setup/react_testing_library.js',
'<rootDir>/src/dev/jest/setup/default_timeout.js',
],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest',
coverageReporters: !!process.env.CODE_COVERAGE ? ['json'] : ['html', 'text'],
Expand Down
25 changes: 25 additions & 0 deletions src/dev/jest/setup/default_timeout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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.
*/

/* eslint-env jest */

/**
* Set the default timeout for the unit tests to 30 seconds, temporarily
*/
jest.setTimeout(30 * 1000);
11 changes: 6 additions & 5 deletions vars/kibanaPipeline.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ def uploadCoverageArtifacts(prefix, pattern) {
def withGcsArtifactUpload(workerName, closure) {
def uploadPrefix = "kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/${workerName}"
def ARTIFACT_PATTERNS = [
'**/target/public/.kbn-optimizer-cache',
'target/kibana-*',
'target/test-metrics/*',
'target/kibana-security-solution/**/*.png',
Expand Down Expand Up @@ -221,7 +220,7 @@ def publishJunit() {
}
}

def sendMail() {
def sendMail(Map params = [:]) {
// If the build doesn't have a result set by this point, there haven't been any errors and it can be marked as a success
// The e-mail plugin for the infra e-mail depends upon this being set
currentBuild.result = currentBuild.result ?: 'SUCCESS'
Expand All @@ -230,7 +229,7 @@ def sendMail() {
if (buildStatus != 'SUCCESS' && buildStatus != 'ABORTED') {
node('flyweight') {
sendInfraMail()
sendKibanaMail()
sendKibanaMail(params)
}
}
}
Expand All @@ -246,12 +245,14 @@ def sendInfraMail() {
}
}

def sendKibanaMail() {
def sendKibanaMail(Map params = [:]) {
def config = [to: 'build-kibana@elastic.co'] + params

catchErrors {
def buildStatus = buildUtils.getBuildStatus()
if(params.NOTIFY_ON_FAILURE && buildStatus != 'SUCCESS' && buildStatus != 'ABORTED') {
emailext(
to: 'build-kibana@elastic.co',
config.to,
subject: "${env.JOB_NAME} - Build # ${env.BUILD_NUMBER} - ${buildStatus}",
body: '${SCRIPT,template="groovy-html.template"}',
mimeType: 'text/html',
Expand Down
1 change: 1 addition & 0 deletions x-pack/dev-tools/jest/create_jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function createJestConfig({ kibanaDirectory, rootDir, xPackKibanaDirector
`${xPackKibanaDirectory}/dev-tools/jest/setup/setup_test.js`,
`${kibanaDirectory}/src/dev/jest/setup/mocks.js`,
`${kibanaDirectory}/src/dev/jest/setup/react_testing_library.js`,
`${kibanaDirectory}/src/dev/jest/setup/default_timeout.js`,
],
testEnvironment: 'jest-environment-jsdom-thirteen',
testMatch: ['**/*.test.{js,mjs,ts,tsx}'],
Expand Down
12 changes: 7 additions & 5 deletions x-pack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
"@storybook/addon-storyshots": "^5.3.19",
"@storybook/react": "^5.3.19",
"@storybook/theming": "^5.3.19",
"@testing-library/jest-dom": "^5.8.0",
"@testing-library/react": "^9.3.2",
"@testing-library/react-hooks": "^3.2.1",
"@testing-library/jest-dom": "^5.8.0",
"@types/angular": "^1.6.56",
"@types/archiver": "^3.1.0",
"@types/base64-js": "^1.2.5",
Expand All @@ -72,8 +72,9 @@
"@types/gulp": "^4.0.6",
"@types/hapi__wreck": "^15.0.1",
"@types/he": "^1.1.1",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/history": "^4.7.3",
"@types/hoist-non-react-statics": "^3.3.1",
"@types/http-proxy": "^1.17.4",
"@types/jest": "^25.2.3",
"@types/jest-specific-snapshot": "^0.5.4",
"@types/joi": "^13.4.2",
Expand All @@ -94,6 +95,7 @@
"@types/object-hash": "^1.3.0",
"@types/papaparse": "^5.0.3",
"@types/pngjs": "^3.3.2",
"@types/pretty-ms": "^5.0.0",
"@types/prop-types": "^15.5.3",
"@types/proper-lockfile": "^3.0.1",
"@types/puppeteer": "^1.20.1",
Expand All @@ -109,18 +111,17 @@
"@types/redux-actions": "^2.6.1",
"@types/set-value": "^2.0.0",
"@types/sinon": "^7.0.13",
"@types/stats-lite": "^2.2.0",
"@types/styled-components": "^5.1.0",
"@types/supertest": "^2.0.5",
"@types/tar-fs": "^1.16.1",
"@types/testing-library__jest-dom": "^5.7.0",
"@types/tinycolor2": "^1.4.1",
"@types/use-resize-observer": "^6.0.0",
"@types/uuid": "^3.4.4",
"@types/webpack-env": "^1.15.2",
"@types/xml-crypto": "^1.4.0",
"@types/xml2js": "^0.4.5",
"@types/stats-lite": "^2.2.0",
"@types/pretty-ms": "^5.0.0",
"@types/webpack-env": "^1.15.2",
"@welldone-software/why-did-you-render": "^4.0.0",
"abab": "^1.0.4",
"autoprefixer": "^9.7.4",
Expand Down Expand Up @@ -227,6 +228,7 @@
"@turf/circle": "6.0.1",
"@turf/distance": "6.0.1",
"@turf/helpers": "6.0.1",
"@types/http-proxy-agent": "^2.0.2",
"angular": "^1.8.0",
"angular-resource": "1.8.0",
"angular-sanitize": "1.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */

import { TypeOf } from '@kbn/config-schema';
import { Logger } from '../../../../../../src/core/server';

import {
ExternalIncidentServiceConfigurationSchema,
Expand Down Expand Up @@ -122,7 +123,12 @@ export interface ExternalServiceApi {

export interface CreateExternalServiceBasicArgs {
api: ExternalServiceApi;
createExternalService: (credentials: ExternalServiceCredentials) => ExternalService;
createExternalService: (
credentials: ExternalServiceCredentials,
logger: Logger,
proxySettings?: any
) => ExternalService;
logger: Logger;
}

export interface CreateExternalServiceArgs extends CreateExternalServiceBasicArgs {
Expand Down
16 changes: 11 additions & 5 deletions x-pack/plugins/actions/server/builtin_action_types/case/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const mapParams = (
export const createConnectorExecutor = ({
api,
createExternalService,
logger,
}: CreateExternalServiceBasicArgs) => async (
execOptions: ActionTypeExecutorOptions<
ExternalIncidentServiceConfiguration,
Expand All @@ -83,10 +84,14 @@ export const createConnectorExecutor = ({
actionId,
};

const externalService = createExternalService({
config,
secrets,
});
const externalService = createExternalService(
{
config,
secrets,
},
logger,
execOptions.proxySettings
);

if (!api[subAction]) {
throw new Error('[Action][ExternalService] Unsupported subAction type.');
Expand Down Expand Up @@ -122,10 +127,11 @@ export const createConnector = ({
validate,
createExternalService,
validationSchema,
logger,
}: CreateExternalServiceArgs) => {
return ({
configurationUtilities,
executor = createConnectorExecutor({ api, createExternalService }),
executor = createConnectorExecutor({ api, createExternalService, logger }),
}: CreateActionTypeArgs): ActionType => ({
...config,
validate: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ describe('execute()', () => {
"message": "a message to you",
"subject": "the subject",
},
"proxySettings": undefined,
"routing": Object {
"bcc": Array [
"jimmy@example.com",
Expand Down Expand Up @@ -326,6 +327,7 @@ describe('execute()', () => {
"message": "a message to you",
"subject": "the subject",
},
"proxySettings": undefined,
"routing": Object {
"bcc": Array [
"jimmy@example.com",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ async function executor(
subject: params.subject,
message: params.message,
},
proxySettings: execOptions.proxySettings,
};

let result;
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/actions/server/builtin_action_types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ export function registerBuiltInActionTypes({
actionTypeRegistry.register(getIndexActionType({ logger }));
actionTypeRegistry.register(getPagerDutyActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getServerLogActionType({ logger }));
actionTypeRegistry.register(getSlackActionType({ configurationUtilities }));
actionTypeRegistry.register(getSlackActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getWebhookActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getServiceNowActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getJiraActionType({ configurationUtilities }));
actionTypeRegistry.register(getResilientActionType({ configurationUtilities }));
actionTypeRegistry.register(getJiraActionType({ logger, configurationUtilities }));
actionTypeRegistry.register(getResilientActionType({ logger, configurationUtilities }));
}
32 changes: 22 additions & 10 deletions x-pack/plugins/actions/server/builtin_action_types/jira/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,33 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Logger } from '../../../../../../src/core/server';
import { createConnector } from '../case/utils';
import { ActionType } from '../../types';

import { api } from './api';
import { config } from './config';
import { validate } from './validators';
import { createExternalService } from './service';
import { JiraSecretConfiguration, JiraPublicConfiguration } from './schema';
import { ActionsConfigurationUtilities } from '../../actions_config';

export const getActionType = createConnector({
api,
config,
validate,
createExternalService,
validationSchema: {
config: JiraPublicConfiguration,
secrets: JiraSecretConfiguration,
},
});
export function getActionType({
logger,
configurationUtilities,
}: {
logger: Logger;
configurationUtilities: ActionsConfigurationUtilities;
}): ActionType {
return createConnector({
api,
config,
validate,
createExternalService,
validationSchema: {
config: JiraPublicConfiguration,
secrets: JiraSecretConfiguration,
},
logger,
})({ configurationUtilities });
}
Loading

0 comments on commit 26c46af

Please sign in to comment.