diff --git a/.buildkite/hooks/post-command b/.buildkite/hooks/post-command new file mode 100755 index 0000000000000..d9a8ad668da0b --- /dev/null +++ b/.buildkite/hooks/post-command @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +.buildkite/scripts/lifecycle/post_command.sh diff --git a/.buildkite/pipelines/es_snapshots/verify.yml b/.buildkite/pipelines/es_snapshots/verify.yml index f67de4819c23a..aa49ba5d2641f 100755 --- a/.buildkite/pipelines/es_snapshots/verify.yml +++ b/.buildkite/pipelines/es_snapshots/verify.yml @@ -28,7 +28,6 @@ steps: parallelism: 13 agents: queue: ci-group-6 - artifact_paths: target/junit/**/*.xml depends_on: build key: default-cigroup retry: @@ -40,7 +39,6 @@ steps: label: 'Docker CI Group' agents: queue: ci-group-6 - artifact_paths: target/junit/**/*.xml depends_on: build key: default-cigroup-docker retry: @@ -50,10 +48,9 @@ steps: - command: .buildkite/scripts/steps/functional/oss_cigroup.sh label: 'OSS CI Group' - parallelism: 12 + parallelism: 11 agents: queue: ci-group-4d - artifact_paths: target/junit/**/*.xml depends_on: build key: oss-cigroup retry: @@ -65,7 +62,6 @@ steps: label: 'Jest Integration Tests' agents: queue: jest - artifact_paths: target/junit/**/*.xml key: jest-integration retry: automatic: @@ -76,7 +72,6 @@ steps: label: 'API Integration Tests' agents: queue: jest - artifact_paths: target/junit/**/*.xml key: api-integration - command: .buildkite/scripts/steps/es_snapshots/trigger_promote.sh @@ -94,6 +89,7 @@ steps: - plugins: - junit-annotate#v1.9.0: artifacts: target/junit/**/*.xml + job-uuid-file-pattern: '-bk__(.*).xml' - wait: ~ continue_on_failure: true diff --git a/.buildkite/pipelines/hourly.yml b/.buildkite/pipelines/hourly.yml new file mode 100644 index 0000000000000..0dc8ad3e08d08 --- /dev/null +++ b/.buildkite/pipelines/hourly.yml @@ -0,0 +1,169 @@ +steps: + - command: .buildkite/scripts/lifecycle/pre_build.sh + label: Pre-Build + + - wait + + - command: .buildkite/scripts/steps/build_kibana.sh + label: Build Kibana Distribution and Plugins + agents: + queue: c2-8 + key: build + if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''" + + - command: .buildkite/scripts/steps/functional/xpack_cigroup.sh + label: 'Default CI Group' + parallelism: 13 + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + key: default-cigroup + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh + label: 'Docker CI Group' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + key: default-cigroup-docker + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_cigroup.sh + label: 'OSS CI Group' + parallelism: 11 + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + key: oss-cigroup + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_accessibility.sh + label: 'OSS Accessibility Tests' + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/xpack_accessibility.sh + label: 'Default Accessibility Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_firefox.sh + label: 'OSS Firefox Tests' + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/xpack_firefox.sh + label: 'Default Firefox Tests' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/oss_misc.sh + label: 'OSS Misc Functional Tests' + agents: + queue: ci-group-4d + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/functional/xpack_saved_object_field_metrics.sh + label: 'Saved Object Field Metrics' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/test/jest_integration.sh + label: 'Jest Integration Tests' + agents: + queue: jest + timeout_in_minutes: 120 + key: jest-integration + + - command: .buildkite/scripts/steps/test/api_integration.sh + label: 'API Integration Tests' + agents: + queue: jest + timeout_in_minutes: 120 + key: api-integration + + - command: .buildkite/scripts/steps/test/jest.sh + label: 'Jest Tests' + agents: + queue: c2-16 + timeout_in_minutes: 120 + key: jest + + - command: .buildkite/scripts/steps/lint.sh + label: 'Linting' + agents: + queue: n2-2 + key: linting + + - command: .buildkite/scripts/steps/checks.sh + label: 'Checks' + agents: + queue: c2-4 + key: checks + + - command: .buildkite/scripts/steps/storybooks/build_and_upload.sh + label: 'Build Storybooks' + agents: + queue: c2-4 + key: storybooks + + - wait: ~ + continue_on_failure: true + + - plugins: + - junit-annotate#v1.9.0: + artifacts: target/junit/**/*.xml + job-uuid-file-pattern: '-bk__(.*).xml' + + - wait: ~ + continue_on_failure: true + + - command: .buildkite/scripts/lifecycle/post_build.sh + label: Post-Build diff --git a/.buildkite/scripts/bootstrap.sh b/.buildkite/scripts/bootstrap.sh index 05a250f8e9e8c..3c6283a4fe3fd 100755 --- a/.buildkite/scripts/bootstrap.sh +++ b/.buildkite/scripts/bootstrap.sh @@ -5,7 +5,7 @@ set -euo pipefail source .buildkite/scripts/common/util.sh echo "--- yarn install and bootstrap" -yarn kbn bootstrap +retry 2 15 yarn kbn bootstrap ### ### upload ts-refs-cache artifacts as quickly as possible so they are available for download diff --git a/.buildkite/scripts/build_kibana_plugins.sh b/.buildkite/scripts/build_kibana_plugins.sh index 14ea71a75bae6..4891ef563dc04 100755 --- a/.buildkite/scripts/build_kibana_plugins.sh +++ b/.buildkite/scripts/build_kibana_plugins.sh @@ -19,13 +19,3 @@ node scripts/build_kibana_platform_plugins \ --scan-dir "$XPACK_DIR/test/usage_collection/plugins" \ --scan-dir "$XPACK_DIR/test/security_functional/fixtures/common" \ --scan-dir "$XPACK_DIR/examples" - -echo "--- Archive built plugins" -shopt -s globstar -tar -zcf \ - target/kibana-default-plugins.tar.gz \ - x-pack/plugins/**/target/public \ - x-pack/test/**/target/public \ - examples/**/target/public \ - x-pack/examples/**/target/public \ - test/**/target/public diff --git a/.buildkite/scripts/common/env.sh b/.buildkite/scripts/common/env.sh index b1701603ec084..282af74bbe18f 100755 --- a/.buildkite/scripts/common/env.sh +++ b/.buildkite/scripts/common/env.sh @@ -11,6 +11,13 @@ PARENT_DIR="$(cd "$KIBANA_DIR/.."; pwd)" export PARENT_DIR export WORKSPACE="${WORKSPACE:-$PARENT_DIR}" +# A few things, such as Chrome, respect this variable +# For many agent types, the workspace is mounted on a local ssd, so will be faster than the default tmp dir location +if [[ -d /opt/local-ssd/buildkite ]]; then + export TMPDIR="/opt/local-ssd/buildkite/tmp" + mkdir -p "$TMPDIR" +fi + KIBANA_PKG_BRANCH="$(jq -r .branch "$KIBANA_DIR/package.json")" export KIBANA_PKG_BRANCH export KIBANA_BASE_BRANCH="$KIBANA_PKG_BRANCH" @@ -28,11 +35,9 @@ export TEST_BROWSER_HEADLESS=1 export ELASTIC_APM_ENVIRONMENT=ci export ELASTIC_APM_TRANSACTION_SAMPLE_RATE=0.1 -CI_REPORTING_ENABLED=false # TODO enable when ready, only controls checks reporter and APM - if is_pr; then export ELASTIC_APM_ACTIVE=false - export CHECKS_REPORTER_ACTIVE="${CI_REPORTING_ENABLED-}" + export CHECKS_REPORTER_ACTIVE=true # These can be removed once we're not supporting Jenkins and Buildkite at the same time # These are primarily used by github checks reporter and can be configured via /github_checks_api.json @@ -42,7 +47,7 @@ if is_pr; then # set_git_merge_base # TODO for PRs else - export ELASTIC_APM_ACTIVE="${CI_REPORTING_ENABLED-}" + export ELASTIC_APM_ACTIVE=true export CHECKS_REPORTER_ACTIVE=false fi diff --git a/.buildkite/scripts/common/setup_bazel.sh b/.buildkite/scripts/common/setup_bazel.sh index 16ea9a3900353..bbd1c58497172 100644 --- a/.buildkite/scripts/common/setup_bazel.sh +++ b/.buildkite/scripts/common/setup_bazel.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash -KIBANA_BUILDBUDDY_CI_API_KEY=$(vault read -field=value secret/kibana-issues/dev/kibana-buildbuddy-ci-api-key) +source .buildkite/scripts/common/util.sh + +KIBANA_BUILDBUDDY_CI_API_KEY=$(retry 5 5 vault read -field=value secret/kibana-issues/dev/kibana-buildbuddy-ci-api-key) export KIBANA_BUILDBUDDY_CI_API_KEY cp "$KIBANA_DIR/src/dev/ci_setup/.bazelrc-ci" "$HOME/.bazelrc" diff --git a/.buildkite/scripts/common/util.sh b/.buildkite/scripts/common/util.sh index 653b0c4e9cdbb..d536f1a37acfd 100755 --- a/.buildkite/scripts/common/util.sh +++ b/.buildkite/scripts/common/util.sh @@ -49,3 +49,28 @@ docker_run() { docker run "${args[@]}" "$@" } + +is_test_execution_step() { + buildkite-agent meta-data set "${BUILDKITE_JOB_ID}_is_test_execution_step" 'true' +} + +retry() { + local retries=$1; shift + local delay=$1; shift + local attempts=1 + + until "$@"; do + retry_exit_status=$? + echo "Exited with $retry_exit_status" >&2 + if (( retries == "0" )); then + return $retry_exit_status + elif (( attempts == retries )); then + echo "Failed $attempts retries" >&2 + return $retry_exit_status + else + echo "Retrying $((retries - attempts)) more times..." >&2 + attempts=$((attempts + 1)) + sleep "$delay" + fi + done +} diff --git a/.buildkite/scripts/lifecycle/post_command.sh b/.buildkite/scripts/lifecycle/post_command.sh new file mode 100755 index 0000000000000..14391fdd1e698 --- /dev/null +++ b/.buildkite/scripts/lifecycle/post_command.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -euo pipefail + +IS_TEST_EXECUTION_STEP="$(buildkite-agent meta-data get "${BUILDKITE_JOB_ID}_is_test_execution_step" --default '')" + +if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then + buildkite-agent artifact upload 'target/junit/**/*' + buildkite-agent artifact upload 'target/kibana-*' + buildkite-agent artifact upload 'target/kibana-coverage/jest/**/*' + buildkite-agent artifact upload 'target/kibana-security-solution/**/*.png' + buildkite-agent artifact upload 'target/test-metrics/*' + buildkite-agent artifact upload 'target/test-suites-ci-plan.json' + buildkite-agent artifact upload 'test/**/screenshots/diff/*.png' + buildkite-agent artifact upload 'test/**/screenshots/failure/*.png' + buildkite-agent artifact upload 'test/**/screenshots/session/*.png' + buildkite-agent artifact upload 'test/functional/failure_debug/html/*.html' + buildkite-agent artifact upload 'x-pack/test/**/screenshots/diff/*.png' + buildkite-agent artifact upload 'x-pack/test/**/screenshots/failure/*.png' + buildkite-agent artifact upload 'x-pack/test/**/screenshots/session/*.png' + buildkite-agent artifact upload 'x-pack/test/functional/apps/reporting/reports/session/*.pdf' + buildkite-agent artifact upload 'x-pack/test/functional/failure_debug/html/*.html' + buildkite-agent artifact upload '.es/**/*.hprof' + + # TODO - re-enable when Jenkins is disabled + # node scripts/report_failed_tests --build-url="${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}" 'target/junit/**/*.xml' +fi diff --git a/.buildkite/scripts/lifecycle/pre_build.sh b/.buildkite/scripts/lifecycle/pre_build.sh index 2ddf9a73d0622..d91597a00a080 100755 --- a/.buildkite/scripts/lifecycle/pre_build.sh +++ b/.buildkite/scripts/lifecycle/pre_build.sh @@ -2,9 +2,11 @@ set -euo pipefail +source .buildkite/scripts/common/util.sh + "$(dirname "${0}")/commit_status_start.sh" -export CI_STATS_TOKEN="$(vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" -export CI_STATS_HOST="$(vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" +export CI_STATS_TOKEN="$(retry 5 5 vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" +export CI_STATS_HOST="$(retry 5 5 vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" node "$(dirname "${0}")/ci_stats_start.js" diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index 759f1e7b4ff9e..d391bea1340a0 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -2,11 +2,17 @@ set -euo pipefail +source .buildkite/scripts/common/util.sh + +node .buildkite/scripts/lifecycle/print_agent_links.js + +echo '--- Job Environment Setup' + cd '.buildkite' yarn install cd - -BUILDKITE_TOKEN="$(vault read -field=buildkite_token_all_jobs secret/kibana-issues/dev/buildkite-ci)" +BUILDKITE_TOKEN="$(retry 5 5 vault read -field=buildkite_token_all_jobs secret/kibana-issues/dev/buildkite-ci)" export BUILDKITE_TOKEN # Set up a custom ES Snapshot Manifest if one has been specified for this build @@ -43,10 +49,10 @@ EOF if [[ "$CI_STATS_BUILD_ID" ]]; then echo "CI Stats Build ID: $CI_STATS_BUILD_ID" - CI_STATS_TOKEN="$(vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" + CI_STATS_TOKEN="$(retry 5 5 vault read -field=api_token secret/kibana-issues/dev/kibana_ci_stats)" export CI_STATS_TOKEN - CI_STATS_HOST="$(vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" + CI_STATS_HOST="$(retry 5 5 vault read -field=api_host secret/kibana-issues/dev/kibana_ci_stats)" export CI_STATS_HOST KIBANA_CI_STATS_CONFIG=$(jq -n \ @@ -59,14 +65,28 @@ EOF fi } -GITHUB_TOKEN=$(vault read -field=github_token secret/kibana-issues/dev/kibanamachine) +GITHUB_TOKEN=$(retry 5 5 vault read -field=github_token secret/kibana-issues/dev/kibanamachine) export GITHUB_TOKEN +KIBANA_CI_REPORTER_KEY=$(retry 5 5 vault read -field=value secret/kibana-issues/dev/kibanamachine-reporter) +export KIBANA_CI_REPORTER_KEY + +# Setup Failed Test Reporter Elasticsearch credentials +{ + TEST_FAILURES_ES_CLOUD_ID=$(retry 5 5 vault read -field=cloud_id secret/kibana-issues/dev/failed_tests_reporter_es) + export TEST_FAILURES_ES_CLOUD_ID + + TEST_FAILURES_ES_USERNAME=$(retry 5 5 vault read -field=username secret/kibana-issues/dev/failed_tests_reporter_es) + export TEST_FAILURES_ES_USERNAME + + TEST_FAILURES_ES_PASSWORD=$(retry 5 5 vault read -field=password secret/kibana-issues/dev/failed_tests_reporter_es) + export TEST_FAILURES_ES_PASSWORD +} + # By default, all steps should set up these things to get a full environment before running # It can be skipped for pipeline upload steps though, to make job start time a little faster if [[ "${SKIP_CI_SETUP:-}" != "true" ]]; then if [[ -d .buildkite/scripts && "${BUILDKITE_COMMAND:-}" != "buildkite-agent pipeline upload"* ]]; then - source .buildkite/scripts/common/util.sh source .buildkite/scripts/common/env.sh source .buildkite/scripts/common/setup_node.sh source .buildkite/scripts/common/setup_bazel.sh diff --git a/.buildkite/scripts/lifecycle/print_agent_links.js b/.buildkite/scripts/lifecycle/print_agent_links.js new file mode 100644 index 0000000000000..e212b17e4ad6a --- /dev/null +++ b/.buildkite/scripts/lifecycle/print_agent_links.js @@ -0,0 +1,21 @@ +const NOW = new Date(); +const TWO_HOURS = new Date(NOW.getTime() + 2 * 60 * 60 * 1000); + +const METRICS_URL = [ + `https://kibana-ops-buildkite-monitoring.kb.us-central1.gcp.cloud.es.io:9243`, + `/app/metrics/link-to/host-detail/${process.env.BUILDKITE_AGENT_NAME}`, + `?to=${TWO_HOURS.getTime()}`, + `&from=${NOW.getTime()}`, +].join(''); + +const LOGS_URL = [ + `https://kibana-ops-buildkite-monitoring.kb.us-central1.gcp.cloud.es.io:9243`, + `/app/logs/link-to/host-logs/${process.env.BUILDKITE_AGENT_NAME}`, + `?time=${NOW.getTime()}`, +].join(''); + +console.log('--- Agent Debug Links'); +console.log('Agent Metrics:'); +console.log('\u001b]1339;' + `url='${METRICS_URL}'\u0007`); +console.log('Agent Logs:'); +console.log('\u001b]1339;' + `url='${LOGS_URL}'\u0007`); diff --git a/.buildkite/scripts/post_build_kibana.sh b/.buildkite/scripts/post_build_kibana.sh index 06864b204bc3c..2194414dd22d3 100755 --- a/.buildkite/scripts/post_build_kibana.sh +++ b/.buildkite/scripts/post_build_kibana.sh @@ -6,7 +6,7 @@ if [[ ! "${DISABLE_CI_STATS_SHIPPING:-}" ]]; then echo "--- Ship Kibana Distribution Metrics to CI Stats" node scripts/ship_ci_stats \ --metrics target/optimizer_bundle_metrics.json \ - --metrics build/kibana/node_modules/@kbn/ui-shared-deps/shared_built_assets/metrics.json + --metrics build/kibana/node_modules/@kbn/ui-shared-deps-src/shared_built_assets/metrics.json fi echo "--- Upload Build Artifacts" diff --git a/.buildkite/scripts/post_build_kibana_plugins.sh b/.buildkite/scripts/post_build_kibana_plugins.sh new file mode 100755 index 0000000000000..288fd262cafa9 --- /dev/null +++ b/.buildkite/scripts/post_build_kibana_plugins.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +echo "--- Archive built plugins" +shopt -s globstar +tar -zcf \ + target/kibana-default-plugins.tar.gz \ + x-pack/plugins/**/target/public \ + x-pack/test/**/target/public \ + examples/**/target/public \ + x-pack/examples/**/target/public \ + test/**/target/public diff --git a/.buildkite/scripts/steps/build_kibana.sh b/.buildkite/scripts/steps/build_kibana.sh index 5896dcac5d444..bf4a9ff243d02 100755 --- a/.buildkite/scripts/steps/build_kibana.sh +++ b/.buildkite/scripts/steps/build_kibana.sh @@ -5,4 +5,5 @@ set -euo pipefail .buildkite/scripts/bootstrap.sh .buildkite/scripts/build_kibana.sh .buildkite/scripts/build_kibana_plugins.sh +.buildkite/scripts/post_build_kibana_plugins.sh .buildkite/scripts/post_build_kibana.sh diff --git a/.buildkite/scripts/steps/checks.sh b/.buildkite/scripts/steps/checks.sh new file mode 100755 index 0000000000000..0d4bc829ead79 --- /dev/null +++ b/.buildkite/scripts/steps/checks.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +.buildkite/scripts/steps/checks/commit/commit.sh +.buildkite/scripts/steps/checks/telemetry.sh +.buildkite/scripts/steps/checks/ts_projects.sh +.buildkite/scripts/steps/checks/jest_configs.sh +.buildkite/scripts/steps/checks/doc_api_changes.sh +.buildkite/scripts/steps/checks/kbn_pm_dist.sh +.buildkite/scripts/steps/checks/plugin_list_docs.sh +.buildkite/scripts/steps/checks/type_check_plugin_public_api_docs.sh +.buildkite/scripts/steps/checks/bundle_limits.sh +.buildkite/scripts/steps/checks/i18n.sh +.buildkite/scripts/steps/checks/file_casing.sh +.buildkite/scripts/steps/checks/licenses.sh +.buildkite/scripts/steps/checks/plugins_with_circular_deps.sh +.buildkite/scripts/steps/checks/verify_notice.sh +.buildkite/scripts/steps/checks/test_projects.sh +.buildkite/scripts/steps/checks/test_hardening.sh diff --git a/.buildkite/scripts/steps/checks/baseline_plugin_public_api_docs.sh b/.buildkite/scripts/steps/checks/baseline_plugin_public_api_docs.sh new file mode 100755 index 0000000000000..5b8bc210ca725 --- /dev/null +++ b/.buildkite/scripts/steps/checks/baseline_plugin_public_api_docs.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Building api docs +node --max-old-space-size=12000 scripts/build_api_docs diff --git a/.buildkite/scripts/steps/checks/bundle_limits.sh b/.buildkite/scripts/steps/checks/bundle_limits.sh new file mode 100755 index 0000000000000..f0885d246f2c6 --- /dev/null +++ b/.buildkite/scripts/steps/checks/bundle_limits.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Bundle Limits + +checks-reporter-with-killswitch "Check Bundle Limits" \ + node scripts/build_kibana_platform_plugins --validate-limits diff --git a/.buildkite/scripts/steps/checks/commit/commit.sh b/.buildkite/scripts/steps/checks/commit/commit.sh new file mode 100755 index 0000000000000..5ff2632103a63 --- /dev/null +++ b/.buildkite/scripts/steps/checks/commit/commit.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +# Runs pre-commit hook script for the files touched in the last commit. +# That way we can ensure a set of quick commit checks earlier as we removed +# the pre-commit hook installation by default. +# If files are more than 200 we will skip it and just use +# the further ci steps that already check linting and file casing for the entire repo. +echo --- Quick commit checks +checks-reporter-with-killswitch "Quick commit checks" \ + "$(dirname "${0}")/commit_check_runner.sh" diff --git a/.buildkite/scripts/steps/checks/commit/commit_check_runner.sh b/.buildkite/scripts/steps/checks/commit/commit_check_runner.sh new file mode 100755 index 0000000000000..8d35c3698f3e1 --- /dev/null +++ b/.buildkite/scripts/steps/checks/commit/commit_check_runner.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +run_quick_commit_checks() { + echo "!!!!!!!! ATTENTION !!!!!!!! +That check is intended to provide earlier CI feedback after we remove the automatic install for the local pre-commit hook. +If you want, you can still manually install the pre-commit hook locally by running 'node scripts/register_git_hook locally' +!!!!!!!!!!!!!!!!!!!!!!!!!!! +" + + node scripts/precommit_hook.js --ref HEAD~1..HEAD --max-files 200 --verbose +} + +run_quick_commit_checks diff --git a/.buildkite/scripts/steps/checks/doc_api_changes.sh b/.buildkite/scripts/steps/checks/doc_api_changes.sh new file mode 100755 index 0000000000000..73a2bb9409d02 --- /dev/null +++ b/.buildkite/scripts/steps/checks/doc_api_changes.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Doc API Changes +checks-reporter-with-killswitch "Check Doc API Changes" \ + node scripts/check_published_api_changes diff --git a/.buildkite/scripts/steps/checks/file_casing.sh b/.buildkite/scripts/steps/checks/file_casing.sh new file mode 100755 index 0000000000000..76e3dce506487 --- /dev/null +++ b/.buildkite/scripts/steps/checks/file_casing.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check File Casing +checks-reporter-with-killswitch "Check File Casing" \ + node scripts/check_file_casing --quiet diff --git a/.buildkite/scripts/steps/checks/i18n.sh b/.buildkite/scripts/steps/checks/i18n.sh new file mode 100755 index 0000000000000..fad455899215d --- /dev/null +++ b/.buildkite/scripts/steps/checks/i18n.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check i18n +checks-reporter-with-killswitch "Check i18n" \ + node scripts/i18n_check --ignore-missing diff --git a/.buildkite/scripts/steps/checks/jest_configs.sh b/.buildkite/scripts/steps/checks/jest_configs.sh new file mode 100755 index 0000000000000..b85687333c92b --- /dev/null +++ b/.buildkite/scripts/steps/checks/jest_configs.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Jest Configs +checks-reporter-with-killswitch "Check Jest Configs" \ + node scripts/check_jest_configs diff --git a/.buildkite/scripts/steps/checks/kbn_pm_dist.sh b/.buildkite/scripts/steps/checks/kbn_pm_dist.sh new file mode 100755 index 0000000000000..61281bc136311 --- /dev/null +++ b/.buildkite/scripts/steps/checks/kbn_pm_dist.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo "--- Building kbn-pm distributable" +yarn kbn run build -i @kbn/pm + +verify_no_git_changes 'yarn kbn run build -i @kbn/pm' diff --git a/.buildkite/scripts/steps/checks/licenses.sh b/.buildkite/scripts/steps/checks/licenses.sh new file mode 100755 index 0000000000000..58add8a8c9530 --- /dev/null +++ b/.buildkite/scripts/steps/checks/licenses.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Licenses +checks-reporter-with-killswitch "Check Licenses" \ + node scripts/check_licenses --dev diff --git a/.buildkite/scripts/steps/checks/plugin_list_docs.sh b/.buildkite/scripts/steps/checks/plugin_list_docs.sh new file mode 100755 index 0000000000000..b422e478aaf7d --- /dev/null +++ b/.buildkite/scripts/steps/checks/plugin_list_docs.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo "--- Building plugin list docs" +node scripts/build_plugin_list_docs + +verify_no_git_changes 'node scripts/build_plugin_list_docs' diff --git a/.buildkite/scripts/steps/checks/plugins_with_circular_deps.sh b/.buildkite/scripts/steps/checks/plugins_with_circular_deps.sh new file mode 100755 index 0000000000000..783b709c18aa4 --- /dev/null +++ b/.buildkite/scripts/steps/checks/plugins_with_circular_deps.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Plugins With Circular Dependencies +checks-reporter-with-killswitch "Check Plugins With Circular Dependencies" \ + node scripts/find_plugins_with_circular_deps diff --git a/.buildkite/scripts/steps/checks/telemetry.sh b/.buildkite/scripts/steps/checks/telemetry.sh new file mode 100755 index 0000000000000..e058d5ceab857 --- /dev/null +++ b/.buildkite/scripts/steps/checks/telemetry.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check Telemetry Schema +checks-reporter-with-killswitch "Check Telemetry Schema" \ + node scripts/telemetry_check diff --git a/.buildkite/scripts/steps/checks/test_hardening.sh b/.buildkite/scripts/steps/checks/test_hardening.sh new file mode 100755 index 0000000000000..c80dd1b0b6fd7 --- /dev/null +++ b/.buildkite/scripts/steps/checks/test_hardening.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Test Hardening +checks-reporter-with-killswitch "Test Hardening" \ + node scripts/test_hardening diff --git a/.buildkite/scripts/steps/checks/test_projects.sh b/.buildkite/scripts/steps/checks/test_projects.sh new file mode 100755 index 0000000000000..4c7d9094cb0c3 --- /dev/null +++ b/.buildkite/scripts/steps/checks/test_projects.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Test Projects +checks-reporter-with-killswitch "Test Projects" \ + yarn kbn run test --exclude kibana --oss --skip-kibana-plugins --skip-missing diff --git a/.buildkite/scripts/steps/checks/ts_projects.sh b/.buildkite/scripts/steps/checks/ts_projects.sh new file mode 100755 index 0000000000000..53b4f536e8f4b --- /dev/null +++ b/.buildkite/scripts/steps/checks/ts_projects.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Check TypeScript Projects +checks-reporter-with-killswitch "Check TypeScript Projects" \ + node scripts/check_ts_projects diff --git a/.buildkite/scripts/steps/checks/type_check_plugin_public_api_docs.sh b/.buildkite/scripts/steps/checks/type_check_plugin_public_api_docs.sh new file mode 100755 index 0000000000000..1d73d1748ddf7 --- /dev/null +++ b/.buildkite/scripts/steps/checks/type_check_plugin_public_api_docs.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Build TS Refs +checks-reporter-with-killswitch "Build TS Refs" \ + node scripts/build_ts_refs \ + --clean \ + --no-cache \ + --force + +echo --- Check Types +checks-reporter-with-killswitch "Check Types" \ + node scripts/type_check + +echo --- Building api docs +node --max-old-space-size=12000 scripts/build_api_docs diff --git a/.buildkite/scripts/steps/checks/verify_notice.sh b/.buildkite/scripts/steps/checks/verify_notice.sh new file mode 100755 index 0000000000000..a92a268bdc886 --- /dev/null +++ b/.buildkite/scripts/steps/checks/verify_notice.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +echo --- Verify NOTICE +checks-reporter-with-killswitch "Verify NOTICE" \ + node scripts/notice --validate diff --git a/.buildkite/scripts/steps/demo_env/kibana.sh b/.buildkite/scripts/steps/demo_env/kibana.sh index 591919e7819c4..f10ed4013bc0c 100755 --- a/.buildkite/scripts/steps/demo_env/kibana.sh +++ b/.buildkite/scripts/steps/demo_env/kibana.sh @@ -2,9 +2,6 @@ set -euo pipefail -export DISABLE_BOOTSTRAP_VALIDATION=true -export BUILD_TS_REFS_DISABLE=true - .buildkite/scripts/bootstrap.sh source "$(dirname "${0}")/config.sh" diff --git a/.buildkite/scripts/steps/functional/common.sh b/.buildkite/scripts/steps/functional/common.sh new file mode 100755 index 0000000000000..b60ed835799e5 --- /dev/null +++ b/.buildkite/scripts/steps/functional/common.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +.buildkite/scripts/bootstrap.sh +.buildkite/scripts/download_build_artifacts.sh + +is_test_execution_step diff --git a/.buildkite/scripts/steps/functional/oss_accessibility.sh b/.buildkite/scripts/steps/functional/oss_accessibility.sh new file mode 100755 index 0000000000000..e8c65cfa760b2 --- /dev/null +++ b/.buildkite/scripts/steps/functional/oss_accessibility.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +echo --- OSS Accessibility Tests + +checks-reporter-with-killswitch "Kibana accessibility tests" \ + node scripts/functional_tests \ + --debug --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --config test/accessibility/config.ts diff --git a/.buildkite/scripts/steps/functional/oss_cigroup.sh b/.buildkite/scripts/steps/functional/oss_cigroup.sh index b4c643868ff7d..a7a5960a41afe 100755 --- a/.buildkite/scripts/steps/functional/oss_cigroup.sh +++ b/.buildkite/scripts/steps/functional/oss_cigroup.sh @@ -2,15 +2,15 @@ set -euo pipefail -.buildkite/scripts/bootstrap.sh -.buildkite/scripts/download_build_artifacts.sh +source .buildkite/scripts/steps/functional/common.sh export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))} export JOB=kibana-oss-ciGroup${CI_GROUP} echo "--- OSS CI Group $CI_GROUP" -node scripts/functional_tests \ - --bail \ - --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ - --include-tag "ciGroup$CI_GROUP" +checks-reporter-with-killswitch "Functional tests / Group ${CI_GROUP}" \ + node scripts/functional_tests \ + --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --include-tag "ciGroup$CI_GROUP" diff --git a/.buildkite/scripts/steps/functional/oss_firefox.sh b/.buildkite/scripts/steps/functional/oss_firefox.sh new file mode 100755 index 0000000000000..e953973da62d6 --- /dev/null +++ b/.buildkite/scripts/steps/functional/oss_firefox.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +echo --- OSS Firefox Smoke Tests + +checks-reporter-with-killswitch "Firefox smoke test" \ + node scripts/functional_tests \ + --bail --debug \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --include-tag "includeFirefox" \ + --config test/functional/config.firefox.js diff --git a/.buildkite/scripts/steps/functional/oss_misc.sh b/.buildkite/scripts/steps/functional/oss_misc.sh new file mode 100755 index 0000000000000..a57a457ca189a --- /dev/null +++ b/.buildkite/scripts/steps/functional/oss_misc.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Required, at least for kbn_sample_panel_action +export BUILD_TS_REFS_DISABLE=false + +source .buildkite/scripts/steps/functional/common.sh + +# Required, at least for plugin_functional tests +.buildkite/scripts/build_kibana_plugins.sh + +echo --- Plugin Functional Tests +checks-reporter-with-killswitch "Plugin Functional Tests" \ + node scripts/functional_tests \ + --config test/plugin_functional/config.ts \ + --bail \ + --debug + +echo --- Interpreter Functional Tests +checks-reporter-with-killswitch "Interpreter Functional Tests" \ + node scripts/functional_tests \ + --config test/interpreter_functional/config.ts \ + --bail \ + --debug \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" + +echo --- Server Integration Tests +checks-reporter-with-killswitch "Server Integration Tests" \ + node scripts/functional_tests \ + --config test/server_integration/http/ssl/config.js \ + --config test/server_integration/http/ssl_redirect/config.js \ + --config test/server_integration/http/platform/config.ts \ + --config test/server_integration/http/ssl_with_p12/config.js \ + --config test/server_integration/http/ssl_with_p12_intermediate/config.js \ + --bail \ + --debug \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" + +# Tests that must be run against source in order to build test plugins +echo --- Status Integration Tests +checks-reporter-with-killswitch "Status Integration Tests" \ + node scripts/functional_tests \ + --config test/server_integration/http/platform/config.status.ts \ + --bail \ + --debug diff --git a/.buildkite/scripts/steps/functional/xpack_accessibility.sh b/.buildkite/scripts/steps/functional/xpack_accessibility.sh new file mode 100755 index 0000000000000..5b098da858c96 --- /dev/null +++ b/.buildkite/scripts/steps/functional/xpack_accessibility.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +cd "$XPACK_DIR" + +echo --- Default Accessibility Tests + +checks-reporter-with-killswitch "X-Pack accessibility tests" \ + node scripts/functional_tests \ + --debug --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --config test/accessibility/config.ts diff --git a/.buildkite/scripts/steps/functional/xpack_cigroup.sh b/.buildkite/scripts/steps/functional/xpack_cigroup.sh index e6ef0bba87904..6877e88cff8b3 100755 --- a/.buildkite/scripts/steps/functional/xpack_cigroup.sh +++ b/.buildkite/scripts/steps/functional/xpack_cigroup.sh @@ -2,8 +2,7 @@ set -euo pipefail -.buildkite/scripts/bootstrap.sh -.buildkite/scripts/download_build_artifacts.sh +source .buildkite/scripts/steps/functional/common.sh export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))} export JOB=kibana-default-ciGroup${CI_GROUP} @@ -12,7 +11,10 @@ echo "--- Default CI Group $CI_GROUP" cd "$XPACK_DIR" -node scripts/functional_tests \ - --bail \ - --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ - --include-tag "ciGroup$CI_GROUP" +checks-reporter-with-killswitch "X-Pack Chrome Functional tests / Group ${CI_GROUP}" \ + node scripts/functional_tests \ + --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --include-tag "ciGroup$CI_GROUP" + +cd "$KIBANA_DIR" diff --git a/.buildkite/scripts/steps/functional/xpack_firefox.sh b/.buildkite/scripts/steps/functional/xpack_firefox.sh new file mode 100755 index 0000000000000..a9a9704ea78de --- /dev/null +++ b/.buildkite/scripts/steps/functional/xpack_firefox.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +cd "$XPACK_DIR" + +echo --- Default Firefox Smoke Tests + +checks-reporter-with-killswitch "X-Pack firefox smoke test" \ + node scripts/functional_tests \ + --debug --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --include-tag "includeFirefox" \ + --config test/functional/config.firefox.js \ + --config test/functional_embedded/config.firefox.ts diff --git a/.buildkite/scripts/steps/functional/xpack_saved_object_field_metrics.sh b/.buildkite/scripts/steps/functional/xpack_saved_object_field_metrics.sh new file mode 100755 index 0000000000000..5e00d2446bf7a --- /dev/null +++ b/.buildkite/scripts/steps/functional/xpack_saved_object_field_metrics.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +.buildkite/scripts/bootstrap.sh +.buildkite/scripts/download_build_artifacts.sh + +cd "$XPACK_DIR" + +echo --- Capture Kibana Saved Objects field count metrics +checks-reporter-with-killswitch "Capture Kibana Saved Objects field count metrics" \ + node scripts/functional_tests \ + --debug --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --config test/saved_objects_field_count/config.ts; diff --git a/.buildkite/scripts/steps/lint.sh b/.buildkite/scripts/steps/lint.sh new file mode 100755 index 0000000000000..dace6c6f60aef --- /dev/null +++ b/.buildkite/scripts/steps/lint.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh + +.buildkite/scripts/bootstrap.sh + +echo '--- Lint: stylelint' +checks-reporter-with-killswitch "Lint: stylelint" \ + node scripts/stylelint + +echo '--- Lint: eslint' +checks-reporter-with-killswitch "Lint: eslint" \ + node scripts/eslint --no-cache diff --git a/.buildkite/scripts/steps/on_merge_build_and_metrics.sh b/.buildkite/scripts/steps/on_merge_build_and_metrics.sh index fdf06981ab568..1f1e492f87bec 100755 --- a/.buildkite/scripts/steps/on_merge_build_and_metrics.sh +++ b/.buildkite/scripts/steps/on_merge_build_and_metrics.sh @@ -2,9 +2,6 @@ set -euo pipefail -export DISABLE_BOOTSTRAP_VALIDATION=true -export BUILD_TS_REFS_DISABLE=true - .buildkite/scripts/bootstrap.sh .buildkite/scripts/build_kibana.sh .buildkite/scripts/post_build_kibana.sh diff --git a/.buildkite/scripts/steps/storybooks/build_and_upload.js b/.buildkite/scripts/steps/storybooks/build_and_upload.js new file mode 100644 index 0000000000000..9d72f518837e9 --- /dev/null +++ b/.buildkite/scripts/steps/storybooks/build_and_upload.js @@ -0,0 +1,106 @@ +const execSync = require('child_process').execSync; +const fs = require('fs'); +const path = require('path'); + +// TODO - how to generate this dynamically? +const STORYBOOKS = [ + 'apm', + 'canvas', + 'ci_composite', + 'url_template_editor', + 'codeeditor', + 'dashboard', + 'dashboard_enhanced', + 'data_enhanced', + 'embeddable', + 'infra', + 'security_solution', + 'ui_actions_enhanced', + 'observability', + 'presentation', + 'lists', +]; + +const GITHUB_CONTEXT = 'Build and Publish Storybooks'; + +const STORYBOOK_DIRECTORY = + process.env.BUILDKITE_PULL_REQUEST && process.env.BUILDKITE_PULL_REQUEST !== 'false' + ? `pr-${process.env.BUILDKITE_PULL_REQUEST}` + : process.env.BUILDKITE_BRANCH.replace('/', '__'); +const STORYBOOK_BUCKET = 'ci-artifacts.kibana.dev/storybooks'; +const STORYBOOK_BUCKET_URL = `https://${STORYBOOK_BUCKET}/${STORYBOOK_DIRECTORY}`; +const STORYBOOK_BASE_URL = `${STORYBOOK_BUCKET_URL}/${process.env.BUILDKITE_COMMIT}`; + +const exec = (...args) => execSync(args.join(' '), { stdio: 'inherit' }); + +const ghStatus = (state, description) => + exec( + `gh api "repos/elastic/kibana/statuses/${process.env.BUILDKITE_COMMIT}"`, + `-f state=${state}`, + `-f target_url="${process.env.BUILDKITE_BUILD_URL}"`, + `-f context="${GITHUB_CONTEXT}"`, + `-f description="${description}"`, + `--silent` + ); + +const build = () => { + console.log('--- Building Storybooks'); + + for (const storybook of STORYBOOKS) { + exec(`STORYBOOK_BASE_URL=${STORYBOOK_BASE_URL}`, `yarn storybook --site ${storybook}`); + } +}; + +const upload = () => { + const originalDirectory = process.cwd(); + try { + console.log('--- Generating Storybooks HTML'); + + process.chdir(path.join('.', 'built_assets', 'storybook')); + fs.renameSync('ci_composite', 'composite'); + + const storybooks = execSync(`ls -1d */`) + .toString() + .trim() + .split('\n') + .map((path) => path.replace('/', '')) + .filter((path) => path != 'composite'); + + const listHtml = storybooks + .map((storybook) => `
string
| |
+| [type](./kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md) | string
| |
+
diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md
new file mode 100644
index 0000000000000..09c7991012da8
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [SavedObjectsBulkResolveObject](./kibana-plugin-core-public.savedobjectsbulkresolveobject.md) > [type](./kibana-plugin-core-public.savedobjectsbulkresolveobject.type.md)
+
+## SavedObjectsBulkResolveObject.type property
+
+Signature:
+
+```typescript
+type: string;
+```
diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md
new file mode 100644
index 0000000000000..36a92d02b8aaa
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.md
@@ -0,0 +1,19 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [SavedObjectsBulkResolveResponse](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.md)
+
+## SavedObjectsBulkResolveResponse interface
+
+
+Signature:
+
+```typescript
+export interface SavedObjectsBulkResolveResponseArray<SavedObjectsResolveResponse<T>>
| |
+
diff --git a/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md
new file mode 100644
index 0000000000000..3597a771efe08
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [SavedObjectsBulkResolveResponse](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.md) > [resolved\_objects](./kibana-plugin-core-public.savedobjectsbulkresolveresponse.resolved_objects.md)
+
+## SavedObjectsBulkResolveResponse.resolved\_objects property
+
+Signature:
+
+```typescript
+resolved_objects: Array(objects?: SavedObjectsBulkCreateObject[], options?: SavedObjectsBulkCreateOptions) => Promise<SavedObjectsBatchResponse<unknown>>
| Creates multiple documents at once |
| [bulkGet](./kibana-plugin-core-public.savedobjectsclient.bulkget.md) | | (objects?: Array<{
id: string;
type: string;
}>) => Promise<SavedObjectsBatchResponse<unknown>>
| Returns an array of objects by id |
+| [bulkResolve](./kibana-plugin-core-public.savedobjectsclient.bulkresolve.md) | | <T = unknown>(objects?: Array<{
id: string;
type: string;
}>) => Promise<{
resolved_objects: ResolvedSimpleSavedObject<T>[];
}>
| Resolves an array of objects by id, using any legacy URL aliases if they exist |
| [create](./kibana-plugin-core-public.savedobjectsclient.create.md) | | <T = unknown>(type: string, attributes: T, options?: SavedObjectsCreateOptions) => Promise<SimpleSavedObject<T>>
| Persists an object |
| [delete](./kibana-plugin-core-public.savedobjectsclient.delete.md) | | (type: string, id: string, options?: SavedObjectsDeleteOptions | undefined) => ReturnType<SavedObjectsApi['delete']>
| Deletes an object |
| [find](./kibana-plugin-core-public.savedobjectsclient.find.md) | | <T = unknown, A = unknown>(options: SavedObjectsFindOptions) => Promise<SavedObjectsFindResponsePublic<T, unknown>>
| Search for objects |
diff --git a/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md b/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md
index 7b2cbdecd146a..2bc7f6cba594d 100644
--- a/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md
+++ b/docs/development/core/server/kibana-plugin-core-server.deprecationsservicesetup.md
@@ -27,6 +27,7 @@ async function getDeprecations({ esClient, savedObjectsClient }: GetDeprecations
const deprecations: DeprecationsDetails[] = [];
const count = await getFooCount(savedObjectsClient);
if (count > 0) {
+ // Example of a manual correctiveAction
deprecations.push({
title: i18n.translate('xpack.foo.deprecations.title', {
defaultMessage: `Foo's are deprecated`
diff --git a/docs/development/core/server/kibana-plugin-core-server.md b/docs/development/core/server/kibana-plugin-core-server.md
index 66c0299669dc4..89203cb94d573 100644
--- a/docs/development/core/server/kibana-plugin-core-server.md
+++ b/docs/development/core/server/kibana-plugin-core-server.md
@@ -146,6 +146,8 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [SavedObjectsBaseOptions](./kibana-plugin-core-server.savedobjectsbaseoptions.md) | |
| [SavedObjectsBulkCreateObject](./kibana-plugin-core-server.savedobjectsbulkcreateobject.md) | |
| [SavedObjectsBulkGetObject](./kibana-plugin-core-server.savedobjectsbulkgetobject.md) | |
+| [SavedObjectsBulkResolveObject](./kibana-plugin-core-server.savedobjectsbulkresolveobject.md) | |
+| [SavedObjectsBulkResolveResponse](./kibana-plugin-core-server.savedobjectsbulkresolveresponse.md) | |
| [SavedObjectsBulkResponse](./kibana-plugin-core-server.savedobjectsbulkresponse.md) | |
| [SavedObjectsBulkUpdateObject](./kibana-plugin-core-server.savedobjectsbulkupdateobject.md) | |
| [SavedObjectsBulkUpdateOptions](./kibana-plugin-core-server.savedobjectsbulkupdateoptions.md) | |
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md
new file mode 100644
index 0000000000000..135848191cff7
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsBulkResolveObject](./kibana-plugin-core-server.savedobjectsbulkresolveobject.md) > [id](./kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md)
+
+## SavedObjectsBulkResolveObject.id property
+
+Signature:
+
+```typescript
+id: string;
+```
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md
new file mode 100644
index 0000000000000..3960511b21434
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.md
@@ -0,0 +1,20 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsBulkResolveObject](./kibana-plugin-core-server.savedobjectsbulkresolveobject.md)
+
+## SavedObjectsBulkResolveObject interface
+
+
+Signature:
+
+```typescript
+export interface SavedObjectsBulkResolveObject
+```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [id](./kibana-plugin-core-server.savedobjectsbulkresolveobject.id.md) | string
| |
+| [type](./kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md) | string
| |
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md
new file mode 100644
index 0000000000000..790edde7fe079
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsBulkResolveObject](./kibana-plugin-core-server.savedobjectsbulkresolveobject.md) > [type](./kibana-plugin-core-server.savedobjectsbulkresolveobject.type.md)
+
+## SavedObjectsBulkResolveObject.type property
+
+Signature:
+
+```typescript
+type: string;
+```
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md
new file mode 100644
index 0000000000000..8384ecc1861f4
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.md
@@ -0,0 +1,19 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsBulkResolveResponse](./kibana-plugin-core-server.savedobjectsbulkresolveresponse.md)
+
+## SavedObjectsBulkResolveResponse interface
+
+
+Signature:
+
+```typescript
+export interface SavedObjectsBulkResolveResponseArray<SavedObjectsResolveResponse<T>>
| |
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.resolved_objects.md b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.resolved_objects.md
new file mode 100644
index 0000000000000..4d11b146fd848
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.savedobjectsbulkresolveresponse.resolved_objects.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [SavedObjectsBulkResolveResponse](./kibana-plugin-core-server.savedobjectsbulkresolveresponse.md) > [resolved\_objects](./kibana-plugin-core-server.savedobjectsbulkresolveresponse.resolved_objects.md)
+
+## SavedObjectsBulkResolveResponse.resolved\_objects property
+
+Signature:
+
+```typescript
+resolved_objects: ArraySavedObjectsBulkResolveObject[]
| an array of objects containing id, type |
+| options | SavedObjectsBaseOptions
| |
+
+Returns:
+
+`PromiseSavedObjectsBulkResolveObject[]
| |
+| options | SavedObjectsBaseOptions
| |
+
+Returns:
+
+`PromiseopenPointInTimeForType
.Only use this API if you have an advanced use case that's not solved by the [SavedObjectsRepository.createPointInTimeFinder()](./kibana-plugin-core-server.savedobjectsrepository.createpointintimefinder.md) method. |
diff --git a/docs/getting-started/images/add-sample-data.png b/docs/getting-started/images/add-sample-data.png
deleted file mode 100644
index 07a536b19d7d0..0000000000000
Binary files a/docs/getting-started/images/add-sample-data.png and /dev/null differ
diff --git a/docs/getting-started/images/addData_sampleDataCards_7.15.0.png b/docs/getting-started/images/addData_sampleDataCards_7.15.0.png
new file mode 100644
index 0000000000000..27e10b98b9670
Binary files /dev/null and b/docs/getting-started/images/addData_sampleDataCards_7.15.0.png differ
diff --git a/docs/getting-started/images/dashboard_ecommerceRevenueDashboard_7.15.0.png b/docs/getting-started/images/dashboard_ecommerceRevenueDashboard_7.15.0.png
new file mode 100644
index 0000000000000..5b62832b1d093
Binary files /dev/null and b/docs/getting-started/images/dashboard_ecommerceRevenueDashboard_7.15.0.png differ
diff --git a/docs/getting-started/images/dashboard_sampleDataAddFilter_7.15.0.png b/docs/getting-started/images/dashboard_sampleDataAddFilter_7.15.0.png
new file mode 100644
index 0000000000000..804fd83de57be
Binary files /dev/null and b/docs/getting-started/images/dashboard_sampleDataAddFilter_7.15.0.png differ
diff --git a/docs/getting-started/images/dashboard_sampleDataFilter_7.15.0.png b/docs/getting-started/images/dashboard_sampleDataFilter_7.15.0.png
new file mode 100644
index 0000000000000..f1f46ab42371a
Binary files /dev/null and b/docs/getting-started/images/dashboard_sampleDataFilter_7.15.0.png differ
diff --git a/docs/getting-started/images/tutorial-sample-dashboard.png b/docs/getting-started/images/tutorial-sample-dashboard.png
deleted file mode 100644
index 5e06009d0824e..0000000000000
Binary files a/docs/getting-started/images/tutorial-sample-dashboard.png and /dev/null differ
diff --git a/docs/getting-started/images/tutorial-sample-filter.png b/docs/getting-started/images/tutorial-sample-filter.png
deleted file mode 100644
index 8823da311ebb5..0000000000000
Binary files a/docs/getting-started/images/tutorial-sample-filter.png and /dev/null differ
diff --git a/docs/getting-started/quick-start-guide.asciidoc b/docs/getting-started/quick-start-guide.asciidoc
index ed249008ac8de..d614aece5b425 100644
--- a/docs/getting-started/quick-start-guide.asciidoc
+++ b/docs/getting-started/quick-start-guide.asciidoc
@@ -31,7 +31,7 @@ Sample data sets come with sample visualizations, dashboards, and more to help y
. On the *Sample eCommerce orders* card, click *Add data*.
+
[role="screenshot"]
-image::images/add-sample-data.png[Add data UI for the sample data sets]
+image::images/addData_sampleDataCards_7.15.0.png[Add data UI for the sample data sets]
[float]
[[explore-the-data]]
@@ -70,7 +70,7 @@ A dashboard is a collection of panels that you can use to view and analyze the d
. Click *[eCommerce] Revenue Dashboard*.
+
[role="screenshot"]
-image::getting-started/images/tutorial-sample-dashboard.png[The [eCommerce] Revenue Dashboard that comes with the Sample eCommerce order data set]
+image::images/dashboard_ecommerceRevenueDashboard_7.15.0.png[The [eCommerce] Revenue Dashboard that comes with the Sample eCommerce order data set]
[float]
[[create-a-visualization]]
@@ -78,14 +78,16 @@ image::getting-started/images/tutorial-sample-dashboard.png[The [eCommerce] Reve
Create a treemap panel that shows the top sales regions and manufacturers, then add the panel to the dashboard.
-. From the toolbar, click *Edit*, then click *Create visualzation*.
+. In the toolbar, click *Edit*.
-. Open the *Chart type* menu, then select *Treemap*.
+. On the dashboard, click *Create visualization*.
+
+. In the drag-and-drop visualization editor, open the *Visualization type* dropdown, then select *Treemap*.
+
[role="screenshot"]
image::getting-started/images/tutorial-visualization-dropdown.png[Chart type menu with Treemap selected]
-. From the *Available fields* list, drag and drop the following fields onto the workspace:
+. From the *Available fields* list, drag the following fields to the workspace:
* *geoip.city_name*
@@ -97,9 +99,6 @@ image::getting-started/images/tutorial-visualization-treemap.png[Treemap that di
. Click *Save and return*.
+
The treemap appears as the last visualization panel on the dashboard.
-+
-[role="screenshot"]
-image::getting-started/images/tutorial-final-dashboard.gif[Final dashboard with new treemap visualization]
[float]
[[interact-with-the-data]]
@@ -114,7 +113,7 @@ You can interact with the dashboard data using controls that allow you to apply
. Click *Apply changes*.
+
[role="screenshot"]
-image::getting-started/images/tutorial-sample-filter.png[The [eCommerce] Revenue Dashboard that shows only the women's clothing data from the Gnomehouse manufacturer]
+image::images/dashboard_sampleDataFilter_7.15.0.png[The [eCommerce] Revenue Dashboard that shows only the women's clothing data from the Gnomehouse manufacturer]
[float]
[[filter-and-query-the-data]]
@@ -133,7 +132,7 @@ To view a subset of the data, you can apply filters to the dashboard panels. App
. Click *Save*.
+
[role="screenshot"]
-image::getting-started/images/tutorial-sample-filter2.png[The [eCommerce] Revenue Dashboard that shows only the women's clothing data generated on Wednesday from the Gnomehouse manufacturer]
+image::images/dashboard_sampleDataAddFilter_7.15.0.png[The [eCommerce] Revenue Dashboard that shows only the women's clothing data generated on Wednesday from the Gnomehouse manufacturer]
[float]
[[quick-start-whats-next]]
diff --git a/docs/maps/images/timeslider_toggle_icon.png b/docs/maps/images/timeslider_toggle_icon.png
new file mode 100644
index 0000000000000..00b09215782ec
Binary files /dev/null and b/docs/maps/images/timeslider_toggle_icon.png differ
diff --git a/docs/maps/index.asciidoc b/docs/maps/index.asciidoc
index cbc00e965e566..157eb0f044666 100644
--- a/docs/maps/index.asciidoc
+++ b/docs/maps/index.asciidoc
@@ -68,7 +68,7 @@ Customize each layer to highlight meaningful dimensions in your data. For exampl
[float]
=== Focus on only the data that’s important to you
-Search across the layers in your map to focus in on just the data you want. Combine free text search with field-based search using the <implements LocatorPublic
{ return url; } + public getRedirectUrl(params: P, options: FormatSearchParamsOptions = {}): string { + const { baseUrl = '', version = '0.0.0' } = this.deps; + const redirectOptions: RedirectOptions = { + id: this.definition.id, + version, + params, + }; + const formatOptions: FormatSearchParamsOptions = { + ...options, + lzCompress: options.lzCompress ?? true, + }; + const search = formatSearchParams(redirectOptions, formatOptions).toString(); + + return baseUrl + '/app/r?' + search; + } + public async navigate( params: P, { replace = false }: LocatorNavigationParams = {} diff --git a/src/plugins/share/public/url_service/redirect/util/format_search_params.test.ts b/src/plugins/share/common/url_service/locators/redirect/format_search_params.test.ts similarity index 66% rename from src/plugins/share/public/url_service/redirect/util/format_search_params.test.ts rename to src/plugins/share/common/url_service/locators/redirect/format_search_params.test.ts index f8d8d6a6295d9..63c2b88e8cf2e 100644 --- a/src/plugins/share/public/url_service/redirect/util/format_search_params.test.ts +++ b/src/plugins/share/common/url_service/locators/redirect/format_search_params.test.ts @@ -6,6 +6,7 @@ * Side Public License, v 1. */ +import { decompressFromBase64 } from 'lz-string'; import { formatSearchParams } from './format_search_params'; import { parseSearchParams } from './parse_search_params'; @@ -41,3 +42,23 @@ test('can format and then parse redirect options', () => { expect(parsed).toEqual(options); }); + +test('compresses params using lz-string when { lzCompress: true } provided', () => { + const options = { + id: 'LOCATOR_ID', + version: '7.21.3', + params: { + dashboardId: '123', + mode: 'edit', + }, + }; + const formatted = formatSearchParams(options, { lzCompress: true }); + const search = new URLSearchParams(formatted); + const paramsJson = decompressFromBase64(search.get('lz')!)!; + + expect(JSON.parse(paramsJson)).toEqual(options.params); + + const parsed = parseSearchParams(formatted.toString()); + + expect(parsed).toEqual(options); +}); diff --git a/src/plugins/share/common/url_service/locators/redirect/format_search_params.ts b/src/plugins/share/common/url_service/locators/redirect/format_search_params.ts new file mode 100644 index 0000000000000..8bcacdd9a7a80 --- /dev/null +++ b/src/plugins/share/common/url_service/locators/redirect/format_search_params.ts @@ -0,0 +1,35 @@ +/* + * 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. + */ + +import { compressToBase64 } from 'lz-string'; +import { RedirectOptions } from './types'; + +export interface FormatSearchParamsOptions { + lzCompress?: boolean; +} + +export function formatSearchParams( + opts: RedirectOptions, + { lzCompress }: FormatSearchParamsOptions = {} +): URLSearchParams { + const searchParams = new URLSearchParams(); + + searchParams.set('l', opts.id); + searchParams.set('v', opts.version); + + const json = JSON.stringify(opts.params); + + if (lzCompress) { + const compressed = compressToBase64(json); + searchParams.set('lz', compressed); + } else { + searchParams.set('p', JSON.stringify(opts.params)); + } + + return searchParams; +} diff --git a/tasks/config/peg.js b/src/plugins/share/common/url_service/locators/redirect/index.ts similarity index 77% rename from tasks/config/peg.js rename to src/plugins/share/common/url_service/locators/redirect/index.ts index 906767d6db285..cf9c0ae1b4f98 100644 --- a/tasks/config/peg.js +++ b/src/plugins/share/common/url_service/locators/redirect/index.ts @@ -6,4 +6,6 @@ * Side Public License, v 1. */ -module.exports = {}; +export * from './types'; +export * from './format_search_params'; +export * from './parse_search_params'; diff --git a/src/plugins/share/public/url_service/redirect/util/parse_search_params.test.ts b/src/plugins/share/common/url_service/locators/redirect/parse_search_params.test.ts similarity index 100% rename from src/plugins/share/public/url_service/redirect/util/parse_search_params.test.ts rename to src/plugins/share/common/url_service/locators/redirect/parse_search_params.test.ts diff --git a/src/plugins/share/public/url_service/redirect/util/parse_search_params.ts b/src/plugins/share/common/url_service/locators/redirect/parse_search_params.ts similarity index 92% rename from src/plugins/share/public/url_service/redirect/util/parse_search_params.ts rename to src/plugins/share/common/url_service/locators/redirect/parse_search_params.ts index 7745e6dad43b1..a4711c30db5d0 100644 --- a/src/plugins/share/public/url_service/redirect/util/parse_search_params.ts +++ b/src/plugins/share/common/url_service/locators/redirect/parse_search_params.ts @@ -8,7 +8,8 @@ import type { SerializableRecord } from '@kbn/utility-types'; import { i18n } from '@kbn/i18n'; -import type { RedirectOptions } from '../redirect_manager'; +import { decompressFromBase64 } from 'lz-string'; +import type { RedirectOptions } from './types'; /** * Parses redirect endpoint URL path search parameters. Expects them in the @@ -23,9 +24,11 @@ import type { RedirectOptions } from '../redirect_manager'; */ export function parseSearchParams(urlSearch: string): RedirectOptions { const search = new URLSearchParams(urlSearch); + const id = search.get('l'); const version = search.get('v'); - const paramsJson = search.get('p'); + const compressed = search.get('lz'); + const paramsJson: string | null = compressed ? decompressFromBase64(compressed) : search.get('p'); if (!id) { const message = i18n.translate( diff --git a/src/plugins/share/common/url_service/locators/redirect/types.ts b/src/plugins/share/common/url_service/locators/redirect/types.ts new file mode 100644 index 0000000000000..67ce994b26614 --- /dev/null +++ b/src/plugins/share/common/url_service/locators/redirect/types.ts @@ -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. + */ + +import type { SerializableRecord } from '@kbn/utility-types'; + +/** + * @public + * Serializable locator parameters that can be used by the redirect service to navigate to a + * location in Kibana. + * + * When passed to the public `share` plugin `.navigate()` function, locator params will also + * be migrated. + */ +export interface RedirectOptions
{ + /** Locator ID. */ + id: string; + + /** Kibana version when locator params were generated. */ + version: string; + + /** Locator params. */ + params: P; +} diff --git a/src/plugins/share/common/url_service/locators/types.ts b/src/plugins/share/common/url_service/locators/types.ts index ba9c6c9185d23..107188b405047 100644 --- a/src/plugins/share/common/url_service/locators/types.ts +++ b/src/plugins/share/common/url_service/locators/types.ts @@ -9,6 +9,7 @@ import type { SerializableRecord } from '@kbn/utility-types'; import { DependencyList } from 'react'; import { PersistableState } from 'src/plugins/kibana_utils/common'; +import type { FormatSearchParamsOptions } from './redirect'; /** * URL locator registry. @@ -62,11 +63,24 @@ export interface LocatorPublic
extends Persistable
/**
* Returns a URL as a string.
*
+ * @deprecated Use `getRedirectUrl` instead. `getRedirectUrl` will preserve
+ * the location state, whereas the `getUrl` just return the URL without
+ * the location state.
+ *
* @param params URL locator parameters.
* @param getUrlParams URL construction parameters.
*/
getUrl(params: P, getUrlParams?: LocatorGetUrlParams): Promise {
- /** Locator ID. */
- id: string;
-
- /** Kibana version when locator params where generated. */
- version: string;
-
- /** Locator params. */
- params: P;
-}
+import { parseSearchParams, RedirectOptions } from '../../../common/url_service/locators/redirect';
export interface RedirectManagerDependencies {
url: UrlService;
@@ -48,7 +27,8 @@ export class RedirectManager {
id: 'r',
title: 'Redirect endpoint',
chromeless: true,
- mount: (params) => {
+ mount: async (params) => {
+ const { render } = await import('./render');
const unmount = render(params.element, { manager: this });
this.onMount(params.history.location.search);
return () => {
diff --git a/src/plugins/share/public/url_service/redirect/util/format_search_params.ts b/src/plugins/share/public/url_service/redirect/util/format_search_params.ts
deleted file mode 100644
index 12c6424182a87..0000000000000
--- a/src/plugins/share/public/url_service/redirect/util/format_search_params.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * 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.
- */
-
-import { RedirectOptions } from '../redirect_manager';
-
-export function formatSearchParams(opts: RedirectOptions): URLSearchParams {
- const searchParams = new URLSearchParams();
-
- searchParams.set('l', opts.id);
- searchParams.set('v', opts.version);
- searchParams.set('p', JSON.stringify(opts.params));
-
- return searchParams;
-}
diff --git a/src/plugins/share/server/plugin.ts b/src/plugins/share/server/plugin.ts
index 76e10372cdb67..18bb72ae24869 100644
--- a/src/plugins/share/server/plugin.ts
+++ b/src/plugins/share/server/plugin.ts
@@ -31,8 +31,10 @@ export class SharePlugin implements Plugin