Skip to content

Commit

Permalink
Merge branch 'main' into eui/43.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thompsongl committed Dec 17, 2021
2 parents 69a308a + 4c1d1ae commit b4c2ab7
Show file tree
Hide file tree
Showing 206 changed files with 5,890 additions and 2,038 deletions.
34 changes: 0 additions & 34 deletions .buildkite/pipelines/flaky_tests/groups.json

This file was deleted.

31 changes: 17 additions & 14 deletions .buildkite/pipelines/flaky_tests/pipeline.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
const groups = /** @type {Array<{key: string, name: string, ciGroups: number }>} */(
require('./groups.json').groups
)

const stepInput = (key, nameOfSuite) => {
return {
key: `ftsr-suite/${key}`,
Expand All @@ -11,31 +7,38 @@ const stepInput = (key, nameOfSuite) => {
};
};

const OSS_CI_GROUPS = 12;
const XPACK_CI_GROUPS = 27;

const inputs = [
{
key: 'ftsr-override-count',
text: 'Override for all suites',
default: '0',
default: 0,
required: true,
},
];

for (const group of groups) {
if (!group.ciGroups) {
inputs.push(stepInput(group.key, group.name))
} else {
for (let i = 1; i <= group.ciGroups; i++) {
inputs.push(stepInput(`${group.key}/${i}`, `${group.name} ${i}`))
}
}
for (let i = 1; i <= OSS_CI_GROUPS; i++) {
inputs.push(stepInput(`oss/cigroup/${i}`, `OSS CI Group ${i}`));
}

inputs.push(stepInput(`oss/firefox`, 'OSS Firefox'));
inputs.push(stepInput(`oss/accessibility`, 'OSS Accessibility'));

for (let i = 1; i <= XPACK_CI_GROUPS; i++) {
inputs.push(stepInput(`xpack/cigroup/${i}`, `Default CI Group ${i}`));
}

inputs.push(stepInput(`xpack/cigroup/Docker`, 'Default CI Group Docker'));
inputs.push(stepInput(`xpack/firefox`, 'Default Firefox'));
inputs.push(stepInput(`xpack/accessibility`, 'Default Accessibility'));

const pipeline = {
steps: [
{
input: 'Number of Runs - Click Me',
fields: inputs,
if: `build.env('KIBANA_FLAKY_TEST_RUNNER_CONFIG') == null`
},
{
wait: '~',
Expand Down
92 changes: 22 additions & 70 deletions .buildkite/pipelines/flaky_tests/runner.js
Original file line number Diff line number Diff line change
@@ -1,85 +1,37 @@
const { execSync } = require('child_process');

const concurrency = 25;
const defaultCount = concurrency * 2;
const initialJobs = 3;

function getTestSuitesFromMetadata() {
const keys = execSync('buildkite-agent meta-data keys')
.toString()
.split('\n')
.filter((k) => k.startsWith('ftsr-suite/'));

const overrideCount = execSync(`buildkite-agent meta-data get 'ftsr-override-count'`).toString().trim();

const testSuites = [];
for (const key of keys) {
if (!key) {
continue;
}
const keys = execSync('buildkite-agent meta-data keys')
.toString()
.split('\n')
.filter((k) => k.startsWith('ftsr-suite/'));

const value =
overrideCount || execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();
const overrideCount = parseInt(
execSync(`buildkite-agent meta-data get 'ftsr-override-count'`).toString().trim()
);

const count = value === '' ? defaultCount : parseInt(value);
totalJobs += count;

testSuites.push({
key: key.replace('ftsr-suite/', ''),
count: count,
});
}

return testSuites
}
const concurrency = 25;
const initialJobs = 3;

function getTestSuitesFromJson(json) {
const fail = (errorMsg) => {
console.error('+++ Invalid test config provided')
console.error(`${errorMsg}: ${json}`);
process.exit(1);
}
let totalJobs = initialJobs;

let parsed;
try {
parsed = JSON.parse(json)
} catch (error) {
fail(`JSON test config did not parse correctly`)
const testSuites = [];
for (const key of keys) {
if (!key) {
continue;
}

if (!Array.isArray(parsed)) {
fail(`JSON test config must be an array`)
}
const value =
overrideCount || execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();

/** @type {Array<{ key: string, count: number }>} */
const testSuites = []
for (const item of parsed) {
if (typeof item !== 'object' || item === null) {
fail(`testSuites must be objects`)
}
const key = item.key
if (typeof key !== 'string') {
fail(`testSuite.key must be a string`)
}
const count = item.count;
if (typeof count !== 'number') {
fail(`testSuite.count must be a number`)
}
testSuites.push({
key,
count,
})
}
const count = value === '' ? defaultCount : parseInt(value);
totalJobs += count;

return testSuites
testSuites.push({
key: key.replace('ftsr-suite/', ''),
count: count,
});
}

const testSuites = process.env.KIBANA_FLAKY_TEST_RUNNER_CONFIG
? getTestSuitesFromJson(process.env.KIBANA_FLAKY_TEST_RUNNER_CONFIG)
: getTestSuitesFromMetadata();

let totalJobs = testSuites.reduce((acc, t) => acc + t.count, initialJobs);

if (totalJobs > 500) {
console.error('+++ Too many tests');
console.error(
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
"base64-js": "^1.3.1",
"bitmap-sdf": "^1.0.3",
"brace": "0.11.1",
"broadcast-channel": "^4.7.1",
"broadcast-channel": "^4.8.0",
"canvg": "^3.0.9",
"chalk": "^4.1.0",
"cheerio": "^1.0.0-rc.10",
Expand Down Expand Up @@ -575,6 +575,8 @@
"@types/kbn__i18n": "link:bazel-bin/packages/kbn-i18n/npm_module_types",
"@types/kbn__i18n-react": "link:bazel-bin/packages/kbn-i18n-react/npm_module_types",
"@types/kbn__mapbox-gl": "link:bazel-bin/packages/kbn-mapbox-gl/npm_module_types",
"@types/kbn__monaco": "link:bazel-bin/packages/kbn-monaco/npm_module_types",
"@types/kbn__optimizer": "link:bazel-bin/packages/kbn-optimizer/npm_module_types",
"@types/license-checker": "15.0.0",
"@types/listr": "^0.14.0",
"@types/loader-utils": "^1.1.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ filegroup(
"//packages/kbn-i18n:build_types",
"//packages/kbn-i18n-react:build_types",
"//packages/kbn-mapbox-gl:build_types",
"//packages/kbn-monaco:build_types",
"//packages/kbn-optimizer:build_types",
],
)

Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-cli-dev-mode/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ TYPES_DEPS = [
"//packages/kbn-config-schema:npm_module_types",
"//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-logging",
"//packages/kbn-optimizer",
"//packages/kbn-optimizer:npm_module_types",
"//packages/kbn-server-http-tools",
"//packages/kbn-std",
"//packages/kbn-utils",
Expand Down
26 changes: 22 additions & 4 deletions packages/kbn-monaco/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@npm//webpack-cli:index.bzl", webpack = "webpack_cli")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")

PKG_BASE_NAME = "kbn-monaco"
PKG_REQUIRE_NAME = "@kbn/monaco"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__monaco"

SOURCE_FILES = glob(
[
Expand Down Expand Up @@ -106,7 +107,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":target_workers", ":tsc_types"],
deps = RUNTIME_DEPS + [":target_node", ":target_web", ":target_workers"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand All @@ -125,3 +126,20 @@ filegroup(
],
visibility = ["//visibility:public"],
)

pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = TYPES_PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)

filegroup(
name = "build_types",
srcs = [
":npm_module_types",
],
visibility = ["//visibility:public"],
)
1 change: 0 additions & 1 deletion packages/kbn-monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"private": true,
"browser": "target_web/index.js",
"main": "target_node/index.js",
"types": "target_types/index.d.ts",
"license": "SSPL-1.0 OR Elastic License 2.0",
"scripts": {
"build:antlr4ts": "../../node_modules/antlr4ts-cli/antlr4ts ./src/painless/antlr/painless_lexer.g4 ./src/painless/antlr/painless_parser.g4 && node ./scripts/fix_generated_antlr.js"
Expand Down
26 changes: 22 additions & 4 deletions packages/kbn-optimizer/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_project")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "pkg_npm")
load("//src/dev/bazel:index.bzl", "jsts_transpiler")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("//src/dev/bazel:index.bzl", "jsts_transpiler", "pkg_npm", "pkg_npm_types", "ts_project")

PKG_BASE_NAME = "kbn-optimizer"
PKG_REQUIRE_NAME = "@kbn/optimizer"
TYPES_PKG_REQUIRE_NAME = "@types/kbn__optimizer"

SOURCE_FILES = glob(
[
Expand Down Expand Up @@ -129,7 +130,7 @@ ts_project(
js_library(
name = PKG_BASE_NAME,
srcs = NPM_MODULE_EXTRA_FILES,
deps = RUNTIME_DEPS + [":target_node", ":tsc_types"],
deps = RUNTIME_DEPS + [":target_node"],
package_name = PKG_REQUIRE_NAME,
visibility = ["//visibility:public"],
)
Expand All @@ -148,3 +149,20 @@ filegroup(
],
visibility = ["//visibility:public"],
)

pkg_npm_types(
name = "npm_module_types",
srcs = SRCS,
deps = [":tsc_types"],
package_name = TYPES_PKG_REQUIRE_NAME,
tsconfig = ":tsconfig",
visibility = ["//visibility:public"],
)

filegroup(
name = "build_types",
srcs = [
":npm_module_types",
],
visibility = ["//visibility:public"],
)
3 changes: 1 addition & 2 deletions packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
"version": "1.0.0",
"private": true,
"license": "SSPL-1.0 OR Elastic License 2.0",
"main": "./target_node/index.js",
"types": "./target_types/index.d.ts"
"main": "./target_node/index.js"
}
2 changes: 1 addition & 1 deletion packages/kbn-plugin-helpers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ RUNTIME_DEPS = [

TYPES_DEPS = [
"//packages/kbn-dev-utils:npm_module_types",
"//packages/kbn-optimizer",
"//packages/kbn-optimizer:npm_module_types",
"//packages/kbn-utils",
"@npm//del",
"@npm//execa",
Expand Down
3 changes: 0 additions & 3 deletions packages/kbn-rule-data-utils/src/technical_field_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const ALERT_RULE_LICENSE = `${ALERT_RULE_NAMESPACE}.license` as const;
const ALERT_RULE_CATEGORY = `${ALERT_RULE_NAMESPACE}.category` as const;
const ALERT_RULE_NAME = `${ALERT_RULE_NAMESPACE}.name` as const;
const ALERT_RULE_NOTE = `${ALERT_RULE_NAMESPACE}.note` as const;
const ALERT_RULE_PARAMS = `${ALERT_RULE_NAMESPACE}.params` as const;
const ALERT_RULE_PARAMETERS = `${ALERT_RULE_NAMESPACE}.parameters` as const;
const ALERT_RULE_REFERENCES = `${ALERT_RULE_NAMESPACE}.references` as const;
const ALERT_RULE_RISK_SCORE = `${ALERT_RULE_NAMESPACE}.risk_score` as const;
Expand Down Expand Up @@ -113,7 +112,6 @@ const fields = {
ALERT_RULE_LICENSE,
ALERT_RULE_NAME,
ALERT_RULE_NOTE,
ALERT_RULE_PARAMS,
ALERT_RULE_PARAMETERS,
ALERT_RULE_REFERENCES,
ALERT_RULE_RISK_SCORE,
Expand Down Expand Up @@ -171,7 +169,6 @@ export {
ALERT_RULE_LICENSE,
ALERT_RULE_NAME,
ALERT_RULE_NOTE,
ALERT_RULE_PARAMS,
ALERT_RULE_PARAMETERS,
ALERT_RULE_REFERENCES,
ALERT_RULE_RISK_SCORE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ export const eventHit = {
],
astring: 'cool',
aNumber: 1,
anObject: {
neat: true,
},
neat: true,
},
],
},
Expand Down
Loading

0 comments on commit b4c2ab7

Please sign in to comment.