Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/elastic/kibana into 119310-…
Browse files Browse the repository at this point in the history
…alerts-table-height-hack
  • Loading branch information
ersin-erdal committed Jan 10, 2022
2 parents 4615fec + 0619acb commit 9737d1f
Show file tree
Hide file tree
Showing 3,229 changed files with 113,884 additions and 871,278 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 9 additions & 4 deletions .backportrc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"upstream": "elastic/kibana",
"repoOwner": "elastic",
"repoName": "kibana",
"targetBranchChoices": [
{ "name": "main", "checked": true },
"main",
"8.0",
"7.17",
"7.16",
"7.15",
"7.14",
Expand Down Expand Up @@ -31,11 +33,14 @@
"6.0",
"5.6"
],
"targetPRLabels": ["backport"],
"targetPRLabels": [
"backport"
],
"branchLabelMapping": {
"^v8.1.0$": "main",
"^v(\\d+).(\\d+).\\d+$": "$1.$2"
},
"autoMerge": true,
"autoMergeMethod": "squash"
"autoMergeMethod": "squash",
"backportBinary": "node scripts/backport"
}
18 changes: 13 additions & 5 deletions .buildkite/pipelines/flaky_tests/pipeline.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
const groups = /** @type {Array<{key: string, name: string, ciGroups: number }>} */(
/*
* 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 groups = /** @type {Array<{key: string, name: string, ciGroups: number }>} */ (
require('./groups.json').groups
)
);

const stepInput = (key, nameOfSuite) => {
return {
Expand All @@ -22,10 +30,10 @@ const inputs = [

for (const group of groups) {
if (!group.ciGroups) {
inputs.push(stepInput(group.key, group.name))
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}`))
inputs.push(stepInput(`${group.key}/${i}`, `${group.name} ${i}`));
}
}
}
Expand All @@ -35,7 +43,7 @@ const pipeline = {
{
input: 'Number of Runs - Click Me',
fields: inputs,
if: `build.env('KIBANA_FLAKY_TEST_RUNNER_CONFIG') == null`
if: `build.env('KIBANA_FLAKY_TEST_RUNNER_CONFIG') == null`,
},
{
wait: '~',
Expand Down
46 changes: 28 additions & 18 deletions .buildkite/pipelines/flaky_tests/runner.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* 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 { execSync } = require('child_process');

const concurrency = 25;
Expand All @@ -10,7 +18,9 @@ function getTestSuitesFromMetadata() {
.split('\n')
.filter((k) => k.startsWith('ftsr-suite/'));

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

const testSuites = [];
for (const key of keys) {
Expand All @@ -19,66 +29,66 @@ function getTestSuitesFromMetadata() {
}

const value =
overrideCount || execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();
overrideCount && overrideCount !== '0'
? overrideCount
: execSync(`buildkite-agent meta-data get '${key}'`).toString().trim();

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

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

return testSuites
return testSuites;
}

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

let parsed;
try {
parsed = JSON.parse(json)
parsed = JSON.parse(json);
} catch (error) {
fail(`JSON test config did not parse correctly`)
fail(`JSON test config did not parse correctly`);
}

if (!Array.isArray(parsed)) {
fail(`JSON test config must be an array`)
fail(`JSON test config must be an array`);
}

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

return testSuites
return testSuites;
}

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);
const totalJobs = testSuites.reduce((acc, t) => acc + t.count, initialJobs);

if (totalJobs > 500) {
console.error('+++ Too many tests');
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [[ "${GITHUB_PR_LABELS:-}" == *"ci:deploy-cloud"* ]]; then
--docker-tag-qualifier="$GIT_COMMIT" \
--docker-push \
--skip-docker-ubi \
--skip-docker-centos \
--skip-docker-ubuntu \
--skip-docker-contexts

CLOUD_IMAGE=$(docker images --format "{{.Repository}}:{{.Tag}}" docker.elastic.co/kibana-ci/kibana-cloud)
Expand Down
9 changes: 8 additions & 1 deletion .buildkite/scripts/common/setup_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ YARN_VERSION=$(node -e "console.log(String(require('./package.json').engines.yar
export YARN_VERSION

if [[ ! $(which yarn) || $(yarn --version) != "$YARN_VERSION" ]]; then
npm install -g "yarn@^${YARN_VERSION}"
rm -rf "$(npm root -g)/yarn" # in case the directory is in a bad state
if [[ ! $(npm install -g "yarn@^${YARN_VERSION}") ]]; then
# If this command is terminated early, e.g. because the build was cancelled in buildkite,
# a yarn directory is left behind in a bad state that can cause all subsequent installs to fail
rm -rf "$(npm root -g)/yarn"
echo "Trying again to install yarn..."
npm install -g "yarn@^${YARN_VERSION}"
fi
fi

yarn config set yarn-offline-mirror "$YARN_OFFLINE_CACHE"
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/lifecycle/annotate_test_failures.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-unresolved
const { TestFailures } = require('kibana-buildkite-library');

(async () => {
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/lifecycle/build_status.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-unresolved
const { BuildkiteClient } = require('kibana-buildkite-library');

(async () => {
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/lifecycle/ci_stats_complete.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-unresolved
const { CiStats } = require('kibana-buildkite-library');

(async () => {
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/lifecycle/ci_stats_start.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-unresolved
const { CiStats } = require('kibana-buildkite-library');

(async () => {
Expand Down
18 changes: 16 additions & 2 deletions .buildkite/scripts/lifecycle/pre_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,22 @@ export BUILDKITE_TOKEN

echo '--- Install buildkite dependencies'
cd '.buildkite'
retry 5 15 yarn install --production --pure-lockfile
cd -

# If this yarn install is terminated early, e.g. if the build is cancelled in buildkite,
# A node module could end up in a bad state that can cause all future builds to fail
# So, let's cache clean and try again to make sure that's not what caused the error
install_deps() {
yarn install --production --pure-lockfile
EXIT=$?
if [[ "$EXIT" != "0" ]]; then
yarn cache clean
fi
return $EXIT
}

retry 5 15 install_deps

cd ..

node .buildkite/scripts/lifecycle/print_agent_links.js || true

Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/lifecycle/print_agent_links.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-unresolved
const { BuildkiteClient } = require('kibana-buildkite-library');

(async () => {
Expand Down
19 changes: 11 additions & 8 deletions .buildkite/scripts/pipelines/pull_request/pipeline.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/*
* 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 execSync = require('child_process').execSync;
const fs = require('fs');
// eslint-disable-next-line import/no-unresolved
const { areChangesSkippable, doAnyChangesMatch } = require('kibana-buildkite-library');

const SKIPPABLE_PATHS = [
Expand Down Expand Up @@ -77,20 +86,14 @@ const uploadPipeline = (pipelineContent) => {
}

if (
(await doAnyChangesMatch([
/^x-pack\/plugins\/fleet/,
/^x-pack\/test\/fleet_cypress/,
])) ||
(await doAnyChangesMatch([/^x-pack\/plugins\/fleet/, /^x-pack\/test\/fleet_cypress/])) ||
process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/fleet_cypress.yml'));
}

if (
(await doAnyChangesMatch([
/^x-pack\/plugins\/osquery/,
/^x-pack\/test\/osquery_cypress/,
])) ||
(await doAnyChangesMatch([/^x-pack\/plugins\/osquery/, /^x-pack\/test\/osquery_cypress/])) ||
process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites')
) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/osquery_cypress.yml'));
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/demo_env/kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source "$(dirname "${0}")/config.sh"
export KIBANA_IMAGE="gcr.io/elastic-kibana-184716/demo/kibana:$DEPLOYMENT_NAME-$(git rev-parse HEAD)"

echo '--- Build Kibana'
node scripts/build --debug --docker-images --example-plugins --skip-os-packages --skip-docker-ubi
node scripts/build --debug --docker-images --example-plugins --skip-docker-ubi

echo '--- Build Docker image with example plugins'
cd target/example_plugins
Expand Down
8 changes: 8 additions & 0 deletions .buildkite/scripts/steps/es_snapshots/bucket_config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* 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.
*/

module.exports = {
BASE_BUCKET_DAILY: 'kibana-ci-es-snapshots-daily',
BASE_BUCKET_PERMANENT: 'kibana-ci-es-snapshots-permanent',
Expand Down
10 changes: 9 additions & 1 deletion .buildkite/scripts/steps/es_snapshots/create_manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* 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 fs = require('fs');
const { execSync } = require('child_process');
const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
Expand Down Expand Up @@ -47,7 +55,7 @@ const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
version: parts[1],
platform: parts[3],
architecture: parts[4].split('.')[0],
license: parts[0] == 'oss' ? 'oss' : 'default',
license: parts[0] === 'oss' ? 'oss' : 'default',
};
});

Expand Down
8 changes: 8 additions & 0 deletions .buildkite/scripts/steps/es_snapshots/promote_manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/*
* 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 fs = require('fs');
const { execSync } = require('child_process');
const { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } = require('./bucket_config.js');
Expand Down
Loading

0 comments on commit 9737d1f

Please sign in to comment.