Skip to content

Commit

Permalink
Merge branch 'master' into 90555
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine committed Feb 19, 2021
2 parents 30b6cf7 + fb2f6ab commit f4a6e25
Show file tree
Hide file tree
Showing 1,356 changed files with 26,823 additions and 10,051 deletions.
3 changes: 2 additions & 1 deletion .backportrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"targetBranchChoices": [
{ "name": "master", "checked": true },
{ "name": "7.x", "checked": true },
"7.12",
"7.11",
"7.10",
"7.9",
Expand All @@ -29,7 +30,7 @@
"targetPRLabels": ["backport"],
"branchLabelMapping": {
"^v8.0.0$": "master",
"^v7.12.0$": "7.x",
"^v7.13.0$": "7.x",
"^v(\\d+).(\\d+).\\d+$": "$1.$2"
},
"autoMerge": true,
Expand Down
28 changes: 28 additions & 0 deletions .ci/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

const config = require('@kbn/storybook').defaultConfig;
const aliases = require('../../src/dev/storybook/aliases.ts').storybookAliases;

config.refs = {};

for (const alias of Object.keys(aliases).filter((a) => a !== 'ci_composite')) {
// snake_case -> Title Case
const title = alias
.replace(/_/g, ' ')
.split(' ')
.map((n) => n[0].toUpperCase() + n.slice(1))
.join(' ');

config.refs[alias] = {
title: title,
url: `${process.env.STORYBOOK_BASE_URL}/${alias}`,
};
}

module.exports = config;
2 changes: 1 addition & 1 deletion .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kibanaPipeline(timeoutMinutes: 300) {
"TIME_STAMP=${timestamp}",
'CODE_COVERAGE=1', // Enables coverage. Needed for multiple ci scripts, such as remote.ts, test/scripts/*.sh, schema.js, etc.
]) {
workers.base(name: 'coverage-worker', size: 'l', ramDisk: false, bootstrapped: false) {
workers.base(name: 'coverage-worker', size: 'xl', ramDisk: false, bootstrapped: false) {
catchError {

kibanaPipeline.bash("""
Expand Down
137 changes: 78 additions & 59 deletions .ci/Jenkinsfile_flaky
Original file line number Diff line number Diff line change
Expand Up @@ -3,47 +3,39 @@
library 'kibana-pipeline-library'
kibanaLibrary.load()

def CI_GROUP_PARAM = params.CI_GROUP
def TASK_PARAM = params.TASK ?: params.CI_GROUP

// Looks like 'oss:ciGroup:1', 'oss:firefoxSmoke'
def JOB_PARTS = CI_GROUP_PARAM.split(':')
def JOB_PARTS = TASK_PARAM.split(':')
def IS_XPACK = JOB_PARTS[0] == 'xpack'
def JOB = JOB_PARTS[1]
def JOB = JOB_PARTS.size() > 1 ? JOB_PARTS[1] : JOB_PARTS[0]
def CI_GROUP = JOB_PARTS.size() > 2 ? JOB_PARTS[2] : ''
def EXECUTIONS = params.NUMBER_EXECUTIONS.toInteger()
def AGENT_COUNT = getAgentCount(EXECUTIONS)

def worker = getWorkerFromParams(IS_XPACK, JOB, CI_GROUP)

def workerFailures = []
def NEED_BUILD = JOB != 'jestIntegration' && JOB != 'apiIntegration'

currentBuild.displayName += trunc(" ${params.GITHUB_OWNER}:${params.branch_specifier}", 24)
currentBuild.description = "${params.CI_GROUP}<br />Agents: ${AGENT_COUNT}<br />Executions: ${params.NUMBER_EXECUTIONS}"

kibanaPipeline(timeoutMinutes: 180) {
def agents = [:]
def workerFailures = []

def worker = getWorkerFromParams(IS_XPACK, JOB, CI_GROUP)

for(def agentNumber = 1; agentNumber <= AGENT_COUNT; agentNumber++) {
def agentNumberInside = agentNumber
def agentExecutions = floor(EXECUTIONS/AGENT_COUNT) + (agentNumber <= EXECUTIONS%AGENT_COUNT ? 1 : 0)

agents["agent-${agentNumber}"] = {
catchErrors {
print "Agent ${agentNumberInside} - ${agentExecutions} executions"

withEnv([
'IGNORE_SHIP_CI_STATS_ERROR=true',
]) {
workers.functional('flaky-test-runner', {
if (!IS_XPACK) {
kibanaPipeline.buildOss()
if (CI_GROUP == '1') {
runbld("./test/scripts/jenkins_build_kbn_sample_panel_action.sh", "Build kbn tp sample panel action for ciGroup1")
}
} else {
kibanaPipeline.buildXpack()
}
}, getWorkerMap(agentNumberInside, agentExecutions, worker, workerFailures))()
}
}
agentProcess(
agentNumber: agentNumber,
agentExecutions: agentExecutions,
worker: worker,
workerFailures: workerFailures,
needBuild: NEED_BUILD,
isXpack: IS_XPACK,
ciGroup: CI_GROUP
)
}
}

Expand All @@ -59,14 +51,70 @@ kibanaPipeline(timeoutMinutes: 180) {
}
}

def agentProcess(Map params = [:]) {
def config = [
agentNumber: 1,
agentExecutions: 0,
worker: {},
workerFailures: [],
needBuild: false,
isXpack: false,
ciGroup: null,
] + params

catchErrors {
print "Agent ${config.agentNumber} - ${config.agentExecutions} executions"

withEnv([
'IGNORE_SHIP_CI_STATS_ERROR=true',
]) {
kibanaPipeline.withTasks([
parallel: 20,
]) {
task {
if (config.needBuild) {
if (!config.isXpack) {
kibanaPipeline.buildOss()
} else {
kibanaPipeline.buildXpack()
}
}

for(def i = 0; i < config.agentExecutions; i++) {
def taskNumber = i
task({
withEnv([
"REMOVE_KIBANA_INSTALL_DIR=1",
]) {
catchErrors {
try {
config.worker()
} catch (ex) {
config.workerFailures << "agent-${config.agentNumber}-${taskNumber}"
throw ex
}
}
}
})
}
}
}
}
}
}

def getWorkerFromParams(isXpack, job, ciGroup) {
if (!isXpack) {
if (job == 'accessibility') {
return kibanaPipeline.functionalTestProcess('kibana-accessibility', './test/scripts/jenkins_accessibility.sh')
} else if (job == 'firefoxSmoke') {
return kibanaPipeline.functionalTestProcess('firefoxSmoke', './test/scripts/jenkins_firefox_smoke.sh')
} else if(job == 'visualRegression') {
} else if (job == 'visualRegression') {
return kibanaPipeline.functionalTestProcess('visualRegression', './test/scripts/jenkins_visual_regression.sh')
} else if (job == 'jestIntegration') {
return kibanaPipeline.scriptTaskDocker('Jest Integration Tests', 'test/scripts/test/jest_integration.sh')
} else if (job == 'apiIntegration') {
return kibanaPipeline.scriptTask('API Integration Tests', 'test/scripts/test/api_integration.sh')
} else {
return kibanaPipeline.ossCiGroupProcess(ciGroup)
}
Expand All @@ -76,45 +124,16 @@ def getWorkerFromParams(isXpack, job, ciGroup) {
return kibanaPipeline.functionalTestProcess('xpack-accessibility', './test/scripts/jenkins_xpack_accessibility.sh')
} else if (job == 'firefoxSmoke') {
return kibanaPipeline.functionalTestProcess('xpack-firefoxSmoke', './test/scripts/jenkins_xpack_firefox_smoke.sh')
} else if(job == 'visualRegression') {
} else if (job == 'visualRegression') {
return kibanaPipeline.functionalTestProcess('xpack-visualRegression', './test/scripts/jenkins_xpack_visual_regression.sh')
} else {
return kibanaPipeline.xpackCiGroupProcess(ciGroup)
}
}

def getWorkerMap(agentNumber, numberOfExecutions, worker, workerFailures, maxWorkerProcesses = 12) {
def workerMap = [:]
def numberOfWorkers = Math.min(numberOfExecutions, maxWorkerProcesses)

for(def i = 1; i <= numberOfWorkers; i++) {
def workerExecutions = floor(numberOfExecutions/numberOfWorkers + (i <= numberOfExecutions%numberOfWorkers ? 1 : 0))

workerMap["agent-${agentNumber}-worker-${i}"] = { workerNumber ->
for(def j = 0; j < workerExecutions; j++) {
print "Execute agent-${agentNumber} worker-${workerNumber}: ${j}"
withEnv([
"REMOVE_KIBANA_INSTALL_DIR=1",
]) {
catchErrors {
try {
worker(workerNumber)
} catch (ex) {
workerFailures << "agent-${agentNumber} worker-${workerNumber}-${j}"
throw ex
}
}
}
}
}
}

return workerMap
}

def getAgentCount(executions) {
// Increase agent count every 24 worker processess, up to 3 agents maximum
return Math.min(3, 1 + floor(executions/24))
// Increase agent count every 20 worker processess, up to 3 agents maximum
return Math.min(3, 1 + floor(executions/20))
}

def trunc(str, length) {
Expand Down
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ node_modules
target
snapshots.js

!/.ci
!/.eslintrc.js
!.storybook

Expand Down
1 change: 1 addition & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"maps_legacy": "src/plugins/maps_legacy",
"monaco": "packages/kbn-monaco/src",
"presentationUtil": "src/plugins/presentation_util",
"indexPatternFieldEditor": "src/plugins/index_pattern_field_editor",
"indexPatternManagement": "src/plugins/index_pattern_management",
"advancedSettings": "src/plugins/advanced_settings",
"kibana_legacy": "src/plugins/kibana_legacy",
Expand Down
30 changes: 30 additions & 0 deletions docs/api/actions-and-connectors.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[[actions-and-connectors-api]]
== Action and connector APIs

Manage Actions and Connectors.

The following action APIs are available:

* <<actions-and-connectors-api-get, Get action API>> to retrieve a single action by ID

* <<actions-and-connectors-api-get-all, Get all actions API>> to retrieve all actions

* <<actions-and-connectors-api-list, List all action types API>> to retrieve a list of all action types

* <<actions-and-connectors-api-create, Create action API>> to create actions

* <<actions-and-connectors-api-update, Update action API>> to update the attributes for an existing action

* <<actions-and-connectors-api-execute, Execute action API>> to execute an action by ID

* <<actions-and-connectors-api-delete, Delete action API>> to delete an action by ID

For information about the actions and connectors that {kib} supports, refer to <<action-types,Action and connector types>>.

include::actions-and-connectors/get.asciidoc[]
include::actions-and-connectors/get_all.asciidoc[]
include::actions-and-connectors/list.asciidoc[]
include::actions-and-connectors/create.asciidoc[]
include::actions-and-connectors/update.asciidoc[]
include::actions-and-connectors/execute.asciidoc[]
include::actions-and-connectors/delete.asciidoc[]
68 changes: 68 additions & 0 deletions docs/api/actions-and-connectors/create.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
[[actions-and-connectors-api-create]]
=== Create action API
++++
<titleabbrev>Create action API</titleabbrev>
++++

Creates an action.

[[actions-and-connectors-api-create-request]]
==== Request

`POST <kibana host>:<port>/api/actions/action`

[[actions-and-connectors-api-create-request-body]]
==== Request body

`name`::
(Required, string) The display name for the action.

`actionTypeId`::
(Required, string) The action type ID for the action.

`config`::
(Required, object) The configuration for the action. Configuration properties vary depending on
the action type. For information about the configuration properties, refer to <<action-types,Action and connector types>>.

`secrets`::
(Required, object) The secrets configuration for the action. Secrets configuration properties vary
depending on the action type. For information about the secrets configuration properties, refer to <<action-types,Action and connector types>>.

[[actions-and-connectors-api-create-request-codes]]
==== Response code

`200`::
Indicates a successful call.

[[actions-and-connectors-api-create-example]]
==== Example

[source,sh]
--------------------------------------------------
$ curl -X POST api/actions/action -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d '
{
"name": "my-action",
"actionTypeId": ".index",
"config": {
"index": "test-index"
}
}'
--------------------------------------------------
// KIBANA

The API returns the following:

[source,sh]
--------------------------------------------------
{
"id": "c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad",
"actionTypeId": ".index",
"name": "my-action",
"config": {
"index": "test-index",
"refresh": false,
"executionTimeField": null
},
"isPreconfigured": false
}
--------------------------------------------------
35 changes: 35 additions & 0 deletions docs/api/actions-and-connectors/delete.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[[actions-and-connectors-api-delete]]
=== Delete action API
++++
<titleabbrev>Delete action API</titleabbrev>
++++

Deletes an action by ID.

WARNING: When you delete an action, _it cannot be recovered_.

[[actions-and-connectors-api-delete-request]]
==== Request

`DELETE <kibana host>:<port>/api/actions/action/<id>`

[[actions-and-connectors-api-delete-path-params]]
==== Path parameters

`id`::
(Required, string) The ID of the action.

[[actions-and-connectors-api-delete-response-codes]]
==== Response code

`200`::
Indicates a successful call.

==== Example

[source,sh]
--------------------------------------------------
$ curl -X DELETE api/actions/action/c55b6eb0-6bad-11eb-9f3b-611eebc6c3ad
--------------------------------------------------
// KIBANA

Loading

0 comments on commit f4a6e25

Please sign in to comment.