diff --git a/.bazelrc b/.bazelrc index 9278352e686ef..c4029cd0bab47 100644 --- a/.bazelrc +++ b/.bazelrc @@ -2,14 +2,6 @@ # Import shared settings first so we can override below import %workspace%/.bazelrc.common -# Remote cache settings for local env -# build --remote_cache=grpcs://cloud.buildbuddy.io -# build --incompatible_remote_results_ignore_disk=true -# build --noremote_upload_local_results -# build --remote_timeout=30 -# build --remote_header=x-buildbuddy-api-key=3EYk49W2NefOx2n3yMze -# build --remote_accept_cached=true - # Enable this in case you want to share your build info # build --build_metadata=VISIBILITY=PUBLIC build --build_metadata=TEST_GROUPS=//packages diff --git a/.buildkite/pipelines/artifacts.yml b/.buildkite/pipelines/artifacts.yml index 773672c5f05f5..eac479d4d450f 100644 --- a/.buildkite/pipelines/artifacts.yml +++ b/.buildkite/pipelines/artifacts.yml @@ -4,29 +4,68 @@ steps: agents: queue: c2-16 timeout_in_minutes: 60 + retry: + automatic: + - exit_status: '*' + limit: 1 - wait - command: TEST_PACKAGE=deb .buildkite/scripts/steps/package_testing/test.sh - label: Package testing for deb + label: Artifact Testing agents: queue: n2-4-virt - timeout_in_minutes: 20 + timeout_in_minutes: 30 + retry: + automatic: + - exit_status: '*' + limit: 1 - command: TEST_PACKAGE=rpm .buildkite/scripts/steps/package_testing/test.sh - label: Package testing for rpm + label: Artifact Testing agents: queue: n2-4-virt - timeout_in_minutes: 20 + timeout_in_minutes: 30 + retry: + automatic: + - exit_status: '*' + limit: 1 - command: TEST_PACKAGE=docker .buildkite/scripts/steps/package_testing/test.sh - label: Package testing for docker + label: Artifact Testing agents: queue: n2-4-virt - timeout_in_minutes: 20 + timeout_in_minutes: 30 + retry: + automatic: + - exit_status: '*' + limit: 1 - command: .buildkite/scripts/steps/artifacts/docker_context.sh - label: 'Docker Build Context' + label: 'Docker Context Verification' agents: queue: n2-2 - timeout_in_minutes: 20 + timeout_in_minutes: 30 + retry: + automatic: + - exit_status: '*' + limit: 1 + + - command: .buildkite/scripts/steps/artifacts/cloud.sh + label: 'Cloud Deployment' + agents: + queue: n2-2 + timeout_in_minutes: 30 + if: "build.env('RELEASE_BUILD') == null || build.env('RELEASE_BUILD') == '' || build.env('RELEASE_BUILD') == 'false'" + retry: + automatic: + - exit_status: '*' + limit: 1 + + - wait + + - command: .buildkite/scripts/steps/artifacts/publish.sh + label: 'Publish Kibana Artifacts' + agents: + queue: n2-2 + timeout_in_minutes: 30 diff --git a/.buildkite/pipelines/es_snapshots/verify.yml b/.buildkite/pipelines/es_snapshots/verify.yml index 18f3440b4acf7..f41af0b4c1475 100755 --- a/.buildkite/pipelines/es_snapshots/verify.yml +++ b/.buildkite/pipelines/es_snapshots/verify.yml @@ -29,7 +29,7 @@ steps: - command: .buildkite/scripts/steps/functional/xpack_cigroup.sh label: 'Default CI Group' - parallelism: 27 + parallelism: 30 agents: queue: n2-4 depends_on: build @@ -40,18 +40,6 @@ steps: - exit_status: '*' limit: 1 - - command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh - label: 'Docker CI Group' - agents: - queue: n2-4 - 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 diff --git a/.buildkite/pipelines/flaky_tests/groups.json b/.buildkite/pipelines/flaky_tests/groups.json index aa061af00bd6c..e471d5c6a8679 100644 --- a/.buildkite/pipelines/flaky_tests/groups.json +++ b/.buildkite/pipelines/flaky_tests/groups.json @@ -26,13 +26,13 @@ "name": "Fleet - Cypress" }, { - "key": "xpack/cigroup", - "name": "Default CI Group", - "ciGroups": 27 + "key": "xpack/cypress/apm_cypress", + "name": "APM - Cypress" }, { - "key": "xpack/cigroup/Docker", - "name": "Default CI Group Docker" + "key": "xpack/cigroup", + "name": "Default CI Group", + "ciGroups": 30 }, { "key": "xpack/firefox", diff --git a/.buildkite/pipelines/on_merge.yml b/.buildkite/pipelines/on_merge.yml index a11f566b06093..9c0f8eecc05b3 100644 --- a/.buildkite/pipelines/on_merge.yml +++ b/.buildkite/pipelines/on_merge.yml @@ -51,7 +51,7 @@ steps: - command: .buildkite/scripts/steps/functional/xpack_cigroup.sh label: 'Default CI Group' - parallelism: 27 + parallelism: 30 agents: queue: n2-4-spot depends_on: build @@ -64,20 +64,6 @@ steps: - exit_status: '*' limit: 1 - - command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh - label: 'Docker CI Group' - agents: - queue: n2-4-spot - depends_on: build - timeout_in_minutes: 120 - key: default-cigroup-docker - retry: - automatic: - - exit_status: '-1' - limit: 3 - - exit_status: '*' - limit: 1 - - command: .buildkite/scripts/steps/functional/oss_cigroup.sh label: 'OSS CI Group' parallelism: 11 diff --git a/.buildkite/pipelines/pull_request/base.yml b/.buildkite/pipelines/pull_request/base.yml index 21f324ed12780..9de2e7bc6d807 100644 --- a/.buildkite/pipelines/pull_request/base.yml +++ b/.buildkite/pipelines/pull_request/base.yml @@ -17,26 +17,16 @@ steps: - command: .buildkite/scripts/steps/functional/xpack_cigroup.sh label: 'Default CI Group' - parallelism: 27 + parallelism: 30 agents: - queue: n2-4 + queue: n2-4-spot-2 depends_on: build timeout_in_minutes: 150 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: n2-4 - depends_on: build - timeout_in_minutes: 120 - key: default-cigroup-docker - retry: - automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -44,12 +34,14 @@ steps: label: 'OSS CI Group' parallelism: 11 agents: - queue: ci-group-4d + queue: n2-4-spot depends_on: build timeout_in_minutes: 120 key: oss-cigroup retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -61,6 +53,8 @@ steps: timeout_in_minutes: 120 retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -72,6 +66,8 @@ steps: timeout_in_minutes: 120 retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -83,6 +79,8 @@ steps: timeout_in_minutes: 120 retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -94,6 +92,8 @@ steps: timeout_in_minutes: 120 retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -105,6 +105,8 @@ steps: timeout_in_minutes: 120 retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -116,6 +118,8 @@ steps: timeout_in_minutes: 120 retry: automatic: + - exit_status: '-1' + limit: 3 - exit_status: '*' limit: 1 @@ -123,17 +127,25 @@ steps: label: 'Jest Tests' parallelism: 8 agents: - queue: n2-4 + queue: n2-4-spot timeout_in_minutes: 90 key: jest + retry: + automatic: + - exit_status: '-1' + limit: 3 - command: .buildkite/scripts/steps/test/jest_integration.sh label: 'Jest Integration Tests' parallelism: 3 agents: - queue: n2-4 + queue: n2-4-spot timeout_in_minutes: 120 key: jest-integration + retry: + automatic: + - exit_status: '-1' + limit: 3 - command: .buildkite/scripts/steps/test/api_integration.sh label: 'API Integration Tests' @@ -141,6 +153,10 @@ steps: queue: n2-2-spot timeout_in_minutes: 120 key: api-integration + retry: + automatic: + - exit_status: '-1' + limit: 3 - command: .buildkite/scripts/steps/lint.sh label: 'Linting' @@ -176,6 +192,10 @@ steps: queue: n2-4-spot key: build_api_docs timeout_in_minutes: 60 + retry: + automatic: + - exit_status: '-1' + limit: 3 - command: .buildkite/scripts/steps/webpack_bundle_analyzer/build_and_upload.sh label: 'Build Webpack Bundle Analyzer reports' diff --git a/.buildkite/pipelines/pull_request/response_ops.yml b/.buildkite/pipelines/pull_request/response_ops.yml new file mode 100644 index 0000000000000..846477170409b --- /dev/null +++ b/.buildkite/pipelines/pull_request/response_ops.yml @@ -0,0 +1,11 @@ +steps: + - command: .buildkite/scripts/steps/functional/response_ops_cases.sh + label: 'Cases Cypress Tests on Security Solution' + agents: + queue: ci-group-6 + depends_on: build + timeout_in_minutes: 120 + retry: + automatic: + - exit_status: '*' + limit: 1 diff --git a/.buildkite/scripts/build_kibana_plugins.sh b/.buildkite/scripts/build_kibana_plugins.sh index 94366d9524346..fafd68d86a65d 100755 --- a/.buildkite/scripts/build_kibana_plugins.sh +++ b/.buildkite/scripts/build_kibana_plugins.sh @@ -3,18 +3,4 @@ set -euo pipefail echo "--- Build Platform Plugins" -node scripts/build_kibana_platform_plugins \ - --scan-dir "$KIBANA_DIR/test/analytics/__fixtures__/plugins" \ - --scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \ - --scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \ - --scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \ - --scan-dir "$KIBANA_DIR/examples" \ - --scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \ - --scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \ - --scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \ - --scan-dir "$XPACK_DIR/test/plugin_api_integration/plugins" \ - --scan-dir "$XPACK_DIR/test/plugin_api_perf/plugins" \ - --scan-dir "$XPACK_DIR/test/licensing_plugin/plugins" \ - --scan-dir "$XPACK_DIR/test/usage_collection/plugins" \ - --scan-dir "$XPACK_DIR/test/security_functional/fixtures/common" \ - --scan-dir "$XPACK_DIR/examples" +node scripts/build_kibana_platform_plugins --examples --test-plugins diff --git a/.buildkite/scripts/common/setup_bazel.sh b/.buildkite/scripts/common/setup_bazel.sh index f9877b16cd424..96cd04fa612fd 100755 --- a/.buildkite/scripts/common/setup_bazel.sh +++ b/.buildkite/scripts/common/setup_bazel.sh @@ -15,8 +15,8 @@ if [[ "${BAZEL_CACHE_MODE:-none}" == read* ]]; then echo "[bazel] enabling caching" cat <> $KIBANA_DIR/.bazelrc build --bes_results_url=https://app.buildbuddy.io/invocation/ - build --bes_backend=grpcs://cloud.buildbuddy.io - build --remote_cache=grpcs://cloud.buildbuddy.io + build --bes_backend=grpcs://remote.buildbuddy.io + build --remote_cache=grpcs://remote.buildbuddy.io build --remote_timeout=3600 build --remote_header=x-buildbuddy-api-key=$KIBANA_BUILDBUDDY_CI_API_KEY EOF diff --git a/.buildkite/scripts/lifecycle/pre_build.sh b/.buildkite/scripts/lifecycle/pre_build.sh index d901594e36ce4..29da2d207dcc4 100755 --- a/.buildkite/scripts/lifecycle/pre_build.sh +++ b/.buildkite/scripts/lifecycle/pre_build.sh @@ -12,3 +12,11 @@ export CI_STATS_TOKEN="$(retry 5 5 vault read -field=api_token secret/kibana-iss 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" + +# We resolve the latest manifest URL at the beginning of the build to ensure that all steps in the build will use the same manifest +# Otherwise, the manifest could change if a step is running around the time that a new one is promoted +if [[ ! "${ES_SNAPSHOT_MANIFEST:-}" ]]; then + BUCKET=$(curl -s "https://storage.googleapis.com/kibana-ci-es-snapshots-daily/$(cat package.json | jq -r .version)/manifest-latest-verified.json" | jq -r .bucket) + ES_SNAPSHOT_MANIFEST_DEFAULT="https://storage.googleapis.com/$BUCKET/manifest.json" + buildkite-agent meta-data set ES_SNAPSHOT_MANIFEST_DEFAULT "$ES_SNAPSHOT_MANIFEST_DEFAULT" +fi diff --git a/.buildkite/scripts/lifecycle/pre_command.sh b/.buildkite/scripts/lifecycle/pre_command.sh index 8b2f1f65a52f4..e7a176a5c2666 100755 --- a/.buildkite/scripts/lifecycle/pre_command.sh +++ b/.buildkite/scripts/lifecycle/pre_command.sh @@ -65,6 +65,15 @@ EOF fi } +# If a custom manifest isn't specified, then use the default one that we resolve earlier in the build +{ + if [[ ! "${ES_SNAPSHOT_MANIFEST:-}" ]]; then + ES_SNAPSHOT_MANIFEST=${ES_SNAPSHOT_MANIFEST:-$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST_DEFAULT --default '')} + export ES_SNAPSHOT_MANIFEST + echo "Using default ES Snapshot Manifest: $ES_SNAPSHOT_MANIFEST" + fi +} + # Setup CI Stats { CI_STATS_BUILD_ID="$(buildkite-agent meta-data get ci_stats_build_id --default '')" diff --git a/.buildkite/scripts/pipelines/pull_request/pipeline.js b/.buildkite/scripts/pipelines/pull_request/pipeline.js index 2d3befd00a890..fa167d9f324b4 100644 --- a/.buildkite/scripts/pipelines/pull_request/pipeline.js +++ b/.buildkite/scripts/pipelines/pull_request/pipeline.js @@ -65,7 +65,6 @@ const uploadPipeline = (pipelineContent) => { if ( (await doAnyChangesMatch([ /^x-pack\/plugins\/security_solution/, - /^x-pack\/plugins\/cases/, /^x-pack\/plugins\/lists/, /^x-pack\/plugins\/timelines/, /^x-pack\/test\/security_solution_cypress/, @@ -77,6 +76,13 @@ const uploadPipeline = (pipelineContent) => { pipeline.push(getPipeline('.buildkite/pipelines/pull_request/security_solution.yml')); } + if ( + (await doAnyChangesMatch([/^x-pack\/plugins\/cases/])) || + process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites') + ) { + pipeline.push(getPipeline('.buildkite/pipelines/pull_request/response_ops.yml')); + } + if ( (await doAnyChangesMatch([/^x-pack\/plugins\/apm/])) || process.env.GITHUB_PR_LABELS.includes('ci:all-cypress-suites') diff --git a/.buildkite/scripts/steps/artifacts/build.sh b/.buildkite/scripts/steps/artifacts/build.sh index 9d40a713d4b0a..4519e5167c91f 100644 --- a/.buildkite/scripts/steps/artifacts/build.sh +++ b/.buildkite/scripts/steps/artifacts/build.sh @@ -4,44 +4,23 @@ set -euo pipefail .buildkite/scripts/bootstrap.sh -if [[ "${RELEASE_BUILD:-}" == "true" ]]; then - VERSION="$(jq -r '.version' package.json)" - RELEASE_ARG="--release" -else - VERSION="$(jq -r '.version' package.json)-SNAPSHOT" - RELEASE_ARG="" -fi +source .buildkite/scripts/steps/artifacts/env.sh -echo "--- Build Kibana Distribution" -node scripts/build "$RELEASE_ARG" --all-platforms --debug --docker-cross-compile --skip-docker-cloud +echo "--- Build Kibana artifacts" +node scripts/build --all-platforms --debug --docker-cross-compile $(echo "$BUILD_ARGS") -echo "--- Build dependencies report" -node scripts/licenses_csv_report "--csv=target/dependencies-$VERSION.csv" - -# Release verification -if [[ "${RELEASE_BUILD:-}" == "true" ]]; then - echo "--- Build and push Kibana Cloud Distribution" - # This doesn't meet the requirements for a release image, implementation TBD - # Beats artifacts will need to match a specific commit sha that matches other stack iamges - # For now this is a placeholder step that will allow us to run automated Cloud tests - # against a best guess approximation of a release image - echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co - trap 'docker logout docker.elastic.co' EXIT +echo "--- Extract default i18n messages" +mkdir -p target/i18n +node scripts/i18n_extract --output-dir=target/i18n - node scripts/build \ - "$RELEASE_ARG" \ - --skip-initialize \ - --skip-generic-folders \ - --skip-platform-folders \ - --skip-archives \ - --docker-images \ - --docker-tag-qualifier="$GIT_COMMIT" \ - --docker-push \ - --skip-docker-ubi \ - --skip-docker-ubuntu \ - --skip-docker-contexts -fi +echo "--- Build dependencies report" +node scripts/licenses_csv_report "--csv=target/dependencies-$FULL_VERSION.csv" +(cd target; sha512sum "dependencies-$FULL_VERSION.csv" > "dependencies-$FULL_VERSION.csv.sha512.txt") +echo "--- Upload Kibana Artifacts" cd target -buildkite-agent artifact upload "*" -cd - \ No newline at end of file +buildkite-agent artifact upload 'kibana-*' +buildkite-agent artifact upload "dependencies-$FULL_VERSION.csv" +buildkite-agent artifact upload "dependencies-$FULL_VERSION.csv.sha512.txt" +buildkite-agent artifact upload 'i18n/*.json' +cd - diff --git a/.buildkite/scripts/steps/artifacts/cloud.sh b/.buildkite/scripts/steps/artifacts/cloud.sh new file mode 100644 index 0000000000000..8fa04a5d176b0 --- /dev/null +++ b/.buildkite/scripts/steps/artifacts/cloud.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +set -euo pipefail + +.buildkite/scripts/bootstrap.sh + +source .buildkite/scripts/steps/artifacts/env.sh + +echo "--- Publish Cloud image" +mkdir -p target +cd target + +buildkite-agent artifact download "kibana-cloud-$FULL_VERSION-docker-image.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" +docker load --input kibana-cloud-$FULL_VERSION-docker-image.tar.gz + +TAG="$FULL_VERSION-$GIT_COMMIT" +KIBANA_BASE_IMAGE="docker.elastic.co/kibana-ci/kibana-cloud:$FULL_VERSION" +KIBANA_TEST_IMAGE="docker.elastic.co/kibana-ci/kibana-cloud:$TAG" + +docker tag "$KIBANA_BASE_IMAGE" "$KIBANA_TEST_IMAGE" + +echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co +trap 'docker logout docker.elastic.co' EXIT + +docker push "$KIBANA_TEST_IMAGE" +docker logout docker.elastic.co + +cd - + +echo "--- Create deployment" +CLOUD_DEPLOYMENT_NAME="kibana-artifacts-$TAG" + +LOGS=$(mktemp --suffix ".json") +DEPLOYMENT_SPEC=$(mktemp --suffix ".json") + +jq ' + .name = "'$CLOUD_DEPLOYMENT_NAME'" | + .resources.kibana[0].plan.kibana.docker_image = "'$KIBANA_TEST_IMAGE'" | + .resources.kibana[0].plan.kibana.version = "'$FULL_VERSION'" | + .resources.elasticsearch[0].plan.elasticsearch.version = "'$FULL_VERSION'" | + .resources.enterprise_search[0].plan.enterprise_search.version = "'$FULL_VERSION'" | + .resources.integrations_server[0].plan.integrations_server.version = "'$FULL_VERSION'" + ' .buildkite/scripts/steps/cloud/deploy.json > "$DEPLOYMENT_SPEC" + +ecctl deployment create --track --output json --file "$DEPLOYMENT_SPEC" &> "$LOGS" +CLOUD_DEPLOYMENT_USERNAME=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.username' "$LOGS") +CLOUD_DEPLOYMENT_PASSWORD=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.password' "$LOGS") +CLOUD_DEPLOYMENT_ID=$(jq -r --slurp '.[0].id' "$LOGS") +CLOUD_DEPLOYMENT_STATUS_MESSAGES=$(jq --slurp '[.[]|select(.resources == null)]' "$LOGS") + +CLOUD_DEPLOYMENT_KIBANA_URL=$(ecctl deployment show "$CLOUD_DEPLOYMENT_ID" | jq -r '.resources.kibana[0].info.metadata.aliased_url') +CLOUD_DEPLOYMENT_ELASTICSEARCH_URL=$(ecctl deployment show "$CLOUD_DEPLOYMENT_ID" | jq -r '.resources.elasticsearch[0].info.metadata.aliased_url') + +# NOTE: disabled pending log sanitization +# echo "--- Setup FTR" +# export TEST_KIBANA_PROTOCOL=$(node -e "console.log(new URL('$CLOUD_DEPLOYMENT_KIBANA_URL').protocol)") +# export TEST_KIBANA_HOSTNAME=$(node -e "console.log(new URL('$CLOUD_DEPLOYMENT_KIBANA_URL').hostname)") +# export TEST_KIBANA_PORT=$(node -e "console.log(new URL('$CLOUD_DEPLOYMENT_KIBANA_URL').port)") +# export TEST_KIBANA_USERNAME=$CLOUD_DEPLOYMENT_USERNAME" +# export TEST_KIBANA_PASS=$CLOUD_DEPLOYMENT_PASSWORD" + +# export TEST_ES_PROTOCOL=$(node -e "console.log(new URL('$CLOUD_DEPLOYMENT_KIBANA_URL').protocol)") +# export TEST_ES_HOSTNAME==$(node -e "console.log(new URL('$CLOUD_DEPLOYMENT_KIBANA_URL').hostname)") +# export TEST_ES_PORT=$(node -e "console.log(new URL('$CLOUD_DEPLOYMENT_KIBANA_URL').port)") +# export TEST_ES_USER="$CLOUD_DEPLOYMENT_USERNAME" +# export TEST_ES_PASS="$CLOUD_DEPLOYMENT_PASSWORD" + +# export TEST_BROWSER_HEADLESS=1 + +# Error: attempted to use the "es" service to fetch Elasticsearch version info but the request failed: ConnectionError: self signed certificate in certificate chain +# export NODE_TLS_REJECT_UNAUTHORIZED=0 + +# echo "--- Run default functional tests" +# node --no-warnings scripts/functional_test_runner.js --include-tag=cloud -exclude-tag=skipCloud + +# echo "--- Run x-pack functional tests" +# cd x-pack +# node --no-warnings scripts/functional_test_runner.js --include-tag=cloud -exclude-tag=skipCloud + +echo "--- Shutdown deployment" +ecctl deployment shutdown "$CLOUD_DEPLOYMENT_ID" --force --track --output json &> "$LOGS" diff --git a/.buildkite/scripts/steps/artifacts/docker_context.sh b/.buildkite/scripts/steps/artifacts/docker_context.sh index 787f5d278febc..a20544de18fd9 100644 --- a/.buildkite/scripts/steps/artifacts/docker_context.sh +++ b/.buildkite/scripts/steps/artifacts/docker_context.sh @@ -4,17 +4,11 @@ set -euo pipefail .buildkite/scripts/bootstrap.sh -if [[ "${RELEASE_BUILD:-}" == "true" ]]; then - VERSION="$(jq -r '.version' package.json)" - RELEASE_ARG="--release" -else - VERSION="$(jq -r '.version' package.json)-SNAPSHOT" - RELEASE_ARG="" -fi +source .buildkite/scripts/steps/artifacts/env.sh echo "--- Create contexts" mkdir -p target -node scripts/build "$RELEASE_ARG" --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives --docker-context-use-local-artifact +node scripts/build --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives --docker-context-use-local-artifact $(echo "$BUILD_ARGS") echo "--- Setup default context" DOCKER_BUILD_FOLDER=$(mktemp -d) @@ -22,7 +16,7 @@ DOCKER_BUILD_FOLDER=$(mktemp -d) tar -xf target/kibana-[0-9]*-docker-build-context.tar.gz -C "$DOCKER_BUILD_FOLDER" cd $DOCKER_BUILD_FOLDER -buildkite-agent artifact download "kibana-$VERSION-linux-x86_64.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" +buildkite-agent artifact download "kibana-$FULL_VERSION-linux-x86_64.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" echo "--- Build context" docker build . diff --git a/.buildkite/scripts/steps/artifacts/env.sh b/.buildkite/scripts/steps/artifacts/env.sh new file mode 100755 index 0000000000000..ea2850ff9a38a --- /dev/null +++ b/.buildkite/scripts/steps/artifacts/env.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -euo pipefail + +RELEASE_BUILD="${RELEASE_BUILD:="false"}" +VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}" + +BASE_VERSION="$(jq -r '.version' package.json)" + +if [[ "$VERSION_QUALIFIER" == "" ]]; then + QUALIFIER_VERSION="$BASE_VERSION" +else + QUALIFIER_VERSION="$BASE_VERSION-$VERSION_QUALIFIER" +fi + +if [[ "$RELEASE_BUILD" == "true" ]]; then + FULL_VERSION="$QUALIFIER_VERSION" + + # Beats artifacts will need to match a specific commit sha that matches other stack images + # for release builds. For now we are skipping Cloud builds until there's a pointer. + BUILD_ARGS="--release --skip-docker-cloud --version-qualifier=$VERSION_QUALIFIER" + WORKFLOW="staging" +else + FULL_VERSION="$QUALIFIER_VERSION-SNAPSHOT" + BUILD_ARGS="--version-qualifier=$VERSION_QUALIFIER" + WORKFLOW="snapshot" +fi + +export VERSION_QUALIFIER +export BASE_VERSION +export QUALIFIER_VERSION +export FULL_VERSION +export BUILD_ARGS +export WORKFLOW diff --git a/.buildkite/scripts/steps/artifacts/publish.sh b/.buildkite/scripts/steps/artifacts/publish.sh new file mode 100644 index 0000000000000..c16d7a02d6cd9 --- /dev/null +++ b/.buildkite/scripts/steps/artifacts/publish.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/common/util.sh +source .buildkite/scripts/steps/artifacts/env.sh + +echo "--- Download and verify artifacts" +function download { + buildkite-agent artifact download "$1" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + buildkite-agent artifact download "$1.sha512.txt" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + sha512sum -c "$1.sha512.txt" + rm "$1.sha512.txt" +} + +mkdir -p target +cd target + +download "kibana-$FULL_VERSION-docker-image.tar.gz" +download "kibana-$FULL_VERSION-docker-image-aarch64.tar.gz" +download "kibana-ubi8-$FULL_VERSION-docker-image.tar.gz" + +download "kibana-$FULL_VERSION-arm64.deb" +download "kibana-$FULL_VERSION-amd64.deb" +download "kibana-$FULL_VERSION-x86_64.rpm" +download "kibana-$FULL_VERSION-aarch64.rpm" + +download "kibana-$FULL_VERSION-docker-build-context.tar.gz" +download "kibana-ironbank-$FULL_VERSION-docker-build-context.tar.gz" +download "kibana-ubi8-$FULL_VERSION-docker-build-context.tar.gz" + +download "kibana-$FULL_VERSION-linux-aarch64.tar.gz" +download "kibana-$FULL_VERSION-linux-x86_64.tar.gz" + +download "kibana-$FULL_VERSION-darwin-x86_64.tar.gz" +download "kibana-$FULL_VERSION-darwin-aarch64.tar.gz" + +download "kibana-$FULL_VERSION-windows-x86_64.zip" + +download "dependencies-$FULL_VERSION.csv" + +cd - + +echo "--- Set artifact permissions" +chmod -R a+r target/* +chmod -R a+w target + +echo "--- Pull latest Release Manager CLI" +echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co +trap 'docker logout docker.elastic.co' EXIT +docker pull docker.elastic.co/infra/release-manager:latest + +echo "--- Publish artifacts" +if [[ "$BUILDKITE_BRANCH" == "$KIBANA_BASE_BRANCH" ]]; then + export VAULT_ROLE_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-role-id)" + export VAULT_SECRET_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-secret-id)" + export VAULT_ADDR="https://secrets.elastic.co:8200" + docker run --rm \ + --name release-manager \ + -e VAULT_ADDR \ + -e VAULT_ROLE_ID \ + -e VAULT_SECRET_ID \ + --mount type=bind,readonly=false,src="$PWD/target",target=/artifacts/target \ + docker.elastic.co/infra/release-manager:latest \ + cli collect \ + --project kibana \ + --branch "$KIBANA_BASE_BRANCH" \ + --commit "$GIT_COMMIT" \ + --workflow "$WORKFLOW" \ + --version "$BASE_VERSION" \ + --qualifier "$VERSION_QUALIFIER" \ + --artifact-set main + + ARTIFACTS_SUBDOMAIN="artifacts-$WORKFLOW" + ARTIFACTS_SUMMARY=$(curl -s "https://$ARTIFACTS_SUBDOMAIN.elastic.co/kibana/latest/$FULL_VERSION.json" | jq -re '.summary_url') + + cat << EOF | buildkite-agent annotate --style "info" --context artifacts-summary + ### Artifacts Summary + + $ARTIFACTS_SUMMARY +EOF + +else + echo "Skipping publish for untracked branch $BUILDKITE_BRANCH" +fi diff --git a/.buildkite/scripts/steps/es_snapshots/create_manifest.js b/.buildkite/scripts/steps/es_snapshots/create_manifest.js index 9357cd72fff06..e20a3262e66e0 100644 --- a/.buildkite/scripts/steps/es_snapshots/create_manifest.js +++ b/.buildkite/scripts/steps/es_snapshots/create_manifest.js @@ -8,7 +8,7 @@ const fs = require('fs'); const { execSync } = require('child_process'); -const { BASE_BUCKET_DAILY } = require('./bucket_config.js'); +const { BASE_BUCKET_DAILY } = require('./bucket_config'); (async () => { console.log('--- Create ES Snapshot Manifest'); diff --git a/.buildkite/scripts/steps/es_snapshots/promote_manifest.js b/.buildkite/scripts/steps/es_snapshots/promote_manifest.js index d7ff670755712..1ba60ae6cd25e 100644 --- a/.buildkite/scripts/steps/es_snapshots/promote_manifest.js +++ b/.buildkite/scripts/steps/es_snapshots/promote_manifest.js @@ -8,7 +8,7 @@ const fs = require('fs'); const { execSync } = require('child_process'); -const { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } = require('./bucket_config.js'); +const { BASE_BUCKET_DAILY, BASE_BUCKET_PERMANENT } = require('./bucket_config'); (async () => { try { diff --git a/.buildkite/scripts/steps/functional/performance_playwright.sh b/.buildkite/scripts/steps/functional/performance_playwright.sh index 9a4301e94f7fe..dad75c9f66a98 100644 --- a/.buildkite/scripts/steps/functional/performance_playwright.sh +++ b/.buildkite/scripts/steps/functional/performance_playwright.sh @@ -20,7 +20,7 @@ sleep 120 cd "$XPACK_DIR" -journeys=("ecommerce_dashboard" "flight_dashboard" "web_logs_dashboard" "promotion_tracking_dashboard") +journeys=("login" "ecommerce_dashboard" "flight_dashboard" "web_logs_dashboard" "promotion_tracking_dashboard" "many_fields_discover") for i in "${journeys[@]}"; do echo "JOURNEY[${i}] is running" @@ -28,7 +28,7 @@ for i in "${journeys[@]}"; do export TEST_PERFORMANCE_PHASE=WARMUP export ELASTIC_APM_ACTIVE=false export JOURNEY_NAME="${i}" - + checks-reporter-with-killswitch "Run Performance Tests with Playwright Config (Journey:${i},Phase: WARMUP)" \ node scripts/functional_tests \ --config test/performance/config.playwright.ts \ diff --git a/.buildkite/scripts/steps/functional/response_ops_cases.sh b/.buildkite/scripts/steps/functional/response_ops_cases.sh new file mode 100755 index 0000000000000..13d0ef52130a3 --- /dev/null +++ b/.buildkite/scripts/steps/functional/response_ops_cases.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail + +source .buildkite/scripts/steps/functional/common.sh + +export JOB=kibana-security-solution-chrome + +echo "--- Response Ops Cases Cypress Tests on Security Solution" + +cd "$XPACK_DIR" + +checks-reporter-with-killswitch "Response Ops Cases Cypress Tests on Security Solution" \ + node scripts/functional_tests \ + --debug --bail \ + --kibana-install-dir "$KIBANA_BUILD_LOCATION" \ + --config test/security_solution_cypress/cases_cli_config.ts diff --git a/.buildkite/scripts/steps/package_testing/test.sh b/.buildkite/scripts/steps/package_testing/test.sh index a9a46502d5b3b..e5ed00f760864 100755 --- a/.buildkite/scripts/steps/package_testing/test.sh +++ b/.buildkite/scripts/steps/package_testing/test.sh @@ -15,12 +15,12 @@ elif [[ "$TEST_PACKAGE" == "rpm" ]]; then buildkite-agent artifact download 'kibana-*.rpm' . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" KIBANA_IP_ADDRESS="192.168.56.6" elif [[ "$TEST_PACKAGE" == "docker" ]]; then - buildkite-agent artifact download "kibana-$KIBANA_PKG_VERSION-SNAPSHOT-docker-image.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" + buildkite-agent artifact download "kibana-$KIBANA_PKG_VERSION*-docker-image.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}" KIBANA_IP_ADDRESS="192.168.56.7" fi cd .. -export VAGRANT_CWD=test/package +export VAGRANT_CWD=$PWD/test/package vagrant up "$TEST_PACKAGE" --no-provision node scripts/es snapshot \ @@ -29,6 +29,16 @@ node scripts/es snapshot \ --license=trial & while ! timeout 1 bash -c "echo > /dev/tcp/localhost/9200"; do sleep 30; done +function echoKibanaLogs { + echo '--- Kibana logs' + if [[ "$TEST_PACKAGE" == "deb" ]] || [[ "$TEST_PACKAGE" == "rpm" ]]; then + vagrant ssh $TEST_PACKAGE -t -c 'sudo cat /var/log/kibana/kibana.log' + elif [[ "$TEST_PACKAGE" == "docker" ]]; then + vagrant ssh $TEST_PACKAGE -t -c 'sudo docker logs kibana' + fi +} +trap "echoKibanaLogs" EXIT + vagrant provision "$TEST_PACKAGE" export TEST_BROWSER_HEADLESS=1 diff --git a/.ci/.storybook/main.js b/.ci/.storybook/main.js index 37f3391337308..c4e017179021a 100644 --- a/.ci/.storybook/main.js +++ b/.ci/.storybook/main.js @@ -7,7 +7,7 @@ */ const config = require('@kbn/storybook').defaultConfig; -const aliases = require('../../src/dev/storybook/aliases.ts').storybookAliases; +const aliases = require('../../src/dev/storybook/aliases').storybookAliases; config.refs = {}; diff --git a/.ci/ci_groups.yml b/.ci/ci_groups.yml index 1be6e8c196a2d..91ef2b2b7acb7 100644 --- a/.ci/ci_groups.yml +++ b/.ci/ci_groups.yml @@ -39,4 +39,6 @@ xpack: - ciGroup25 - ciGroup26 - ciGroup27 - - ciGroupDocker + - ciGroup28 + - ciGroup29 + - ciGroup30 diff --git a/.eslintrc.js b/.eslintrc.js index 08af34d24e7f5..3c1c455fc3295 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1452,6 +1452,20 @@ module.exports = { plugins: ['react', '@typescript-eslint'], files: ['x-pack/plugins/osquery/**/*.{js,mjs,ts,tsx}'], rules: { + 'padding-line-between-statements': [ + 'error', + { + blankLine: 'always', + prev: ['block-like'], + next: ['*'], + }, + { + blankLine: 'always', + prev: ['*'], + next: ['return'], + }, + ], + 'padded-blocks': ['error', 'always'], 'arrow-body-style': ['error', 'as-needed'], 'prefer-arrow-callback': 'error', 'no-unused-vars': 'off', diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b846bc0801870..d7c74279d61e4 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -88,7 +88,6 @@ ### Observability Plugins # Observability Shared -/x-pack/plugins/observability/ @elastic/observability-ui /x-pack/plugins/observability/public/components/shared/date_picker/ @elastic/uptime # Unified Observability @@ -103,6 +102,7 @@ /x-pack/plugins/observability/public/rules @elastic/actionable-observability /x-pack/plugins/observability/public/pages/alerts @elastic/actionable-observability /x-pack/plugins/observability/public/pages/cases @elastic/actionable-observability +/x-pack/plugins/observability/public/pages/rules @elastic/actionable-observability # Infra Monitoring /x-pack/plugins/infra/ @elastic/infra-monitoring-ui @@ -400,8 +400,150 @@ #CC# /x-pack/plugins/security_solution/ @elastic/security-solution # Security Solution sub teams -/x-pack/plugins/timelines @elastic/security-threat-hunting -/x-pack/plugins/lists @elastic/security-detections-response + +## Security Solution sub teams - Threat Hunting Investigations +/x-pack/plugins/timelines @elastic/security-threat-hunting-investigations + +/x-pack/plugins/security_solution/common/search_strategy/timeline @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/common/types/timeline @elastic/security-threat-hunting-investigations + +/x-pack/plugins/security_solution/cypress/integration/timeline_templates @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/cypress/integration/timeline @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/cypress/integration/detection_alerts @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/cypress/integration/urls @elastic/security-threat-hunting-investigations + +/x-pack/plugins/security_solution/public/common/components/alerts_viewer @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/common/components/event_details @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/common/components/events_viewer @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/common/components/markdown_editor @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/detections/components/alerts_kpis @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/detections/components/alerts_table @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/detections/components/alerts_info @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/resolver @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/public/timelines @elastic/security-threat-hunting-investigations + +/x-pack/plugins/security_solution/server/lib/timeline @elastic/security-threat-hunting-investigations + +## Security Solution sub teams - Threat Hunting Explore +/x-pack/plugins/security_solution/common/search_strategy/security_solution/hosts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/common/search_strategy/security_solution/matrix_histogram @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/common/search_strategy/security_solution/network @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/common/search_strategy/security_solution/user @elastic/security-threat-hunting-explore + +/x-pack/plugins/security_solution/cypress/integration/cases @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/integration/host_details @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/integration/hosts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/integration/network @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/integration/overview @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/integration/pagination @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/integration/users @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/screens/hosts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/screens/network @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/tasks/hosts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/tasks/network @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/cypress/upgrade_integration/threat_hunting/cases @elastic/security-threat-hunting-explore + +/x-pack/plugins/security_solution/public/common/components/charts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/header_page @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/header_section @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/inspect @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/last_event_time @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/links @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/matrix_histogram @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/navigation @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/news_feed @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/overview_description_list @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/paginated_table @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/sidebar_header @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/stat_items @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/tables @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/top_n @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/components/with_hover_actions @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/containers/hosts_risk @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/containers/matrix_histogram @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/common/lib/cell_actions @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/cases @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/hosts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/network @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/overview @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/public/users @elastic/security-threat-hunting-explore + +/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/matrix_histogram @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/network @elastic/security-threat-hunting-explore +/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users @elastic/security-threat-hunting-explore + +## Security Solution sub teams - Detections and Response Alerts +/x-pack/plugins/security_solution/public/detections/pages/alerts @elastic/security-detections-response-alerts + +/x-pack/plugins/security_solution/server/lib/detection_engine/migrations @elastic/security-detections-response-alerts +/x-pack/plugins/security_solution/server/lib/detection_engine/notifications @elastic/security-detections-response-alerts +/x-pack/plugins/security_solution/server/lib/detection_engine/schemas @elastic/security-detections-response-alerts +/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types @elastic/security-detections-response-alerts +/x-pack/plugins/security_solution/server/lib/detection_engine/signals @elastic/security-detections-response-alerts +/x-pack/plugins/security_solution/server/lib/detection_engine/routes/index @elastic/security-detections-response-alerts +/x-pack/plugins/security_solution/server/lib/detection_engine/routes/signals @elastic/security-detections-response-alerts + + +## Security Solution sub teams - Detections and Response Rules +/x-pack/plugins/security_solution/cypress/integration/detection_rules @elastic/security-detections-response-rules + +/x-pack/plugins/security_solution/public/detections/components/rules @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/detections/components/severity @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/detections/components/status @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/rules @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/common/components/health_truncate_text @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/common/components/links_to_docs @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/common/components/callouts @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/detections/components/callouts @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/detections/mitre @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/public/detections/containers/detection_engine/rules @elastic/security-detections-response-rules + +/x-pack/plugins/security_solution/server/lib/detection_engine/rule_actions @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/server/lib/detection_engine/rule_execution_log @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/server/lib/detection_engine/rules @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/server/utils @elastic/security-detections-response-rules +/x-pack/plugins/security_solution/server/lib/detection_engine/tags @elastic/security-detections-response-rules + +## Security Solution sub teams - Security Platform +/x-pack/plugins/lists @elastic/security-solution-platform + +/x-pack/plugins/security_solution/cypress/integration/data_sources @elastic/security-solution-platform +/x-pack/plugins/security_solution/cypress/integration/exceptions @elastic/security-solution-platform +/x-pack/plugins/security_solution/cypress/integration/value_lists @elastic/security-solution-platform + +/x-pack/plugins/security_solution/public/common/components/exceptions @elastic/security-solution-platform +/x-pack/plugins/security_solution/public/exceptions @elastic/security-solution-platform +/x-pack/plugins/security_solution/public/detections/containers/detection_engine/lists @elastic/security-solution-platform +/x-pack/plugins/security_solution/public/common/components/sourcerer @elastic/security-solution-platform + +/x-pack/plugins/security_solution/server/lib/sourcerer @elastic/security-solution-platform +/packages/kbn-securitysolution* @elastic/security-solution-platform + + +## Security Solution sub teams - Security Threat Intelligence +/x-pack/plugins/security_solution/public/common/components/threat_match @elastic/security-threat-intelligence + +## Security Solution cross teams ownership +/x-pack/plugins/security_solution/cypress/downloads @elastic/security-detections-response @elastic/security-threat-hunting +/x-pack/plugins/security_solution/cypress/fixtures @elastic/security-detections-response @elastic/security-threat-hunting +/x-pack/plugins/security_solution/cypress/helpers @elastic/security-detections-response @elastic/security-threat-hunting +/x-pack/plugins/security_solution/cypress/objects @elastic/security-detections-response @elastic/security-threat-hunting +/x-pack/plugins/security_solution/cypress/plugins @elastic/security-detections-response @elastic/security-threat-hunting +/x-pack/plugins/security_solution/cypress/support @elastic/security-detections-response @elastic/security-threat-hunting +/x-pack/plugins/security_solution/cypress/urls @elastic/security-threat-hunting-investigations @elastic/security-solution-platform + +/x-pack/plugins/security_solution/screens/common @elastic/security-detections-response @elastic/security-threat-hunting + +/x-pack/plugins/security_solution/common/ecs @elastic/security-detections-response-rules @elastic/security-threat-hunting-investigations +/x-pack/plugins/security_solution/common/test @elastic/security-detections-response-rules @elastic/security-detections-response-alerts + +/x-pack/plugins/security_solution/public/common/components/hover_actions @elastic/security-threat-hunting-explore @elastic/security-threat-hunting-investigations + +/x-pack/plugins/security_solution/server/routes @elastic/security-detections-response-alerts @elastic/security-detections-response-rules + ## Security Solution sub teams - security-onboarding-and-lifecycle-mgt /x-pack/plugins/security_solution/public/management/ @elastic/security-onboarding-and-lifecycle-mgt @@ -429,10 +571,12 @@ x-pack/test/security_solution_cypress @elastic/security-engineering-productivity ## Security Solution sub teams - adaptive-workload-protection x-pack/plugins/session_view @elastic/awp-platform +x-pack/plugins/security_solution/public/common/components/sessions_viewer @elastic/awp-platform # Security Intelligence And Analytics /x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules @elastic/security-intelligence-analytics + # Security Asset Management /x-pack/plugins/osquery @elastic/security-asset-management @@ -462,10 +606,12 @@ x-pack/plugins/session_view @elastic/awp-platform # Reporting /x-pack/examples/reporting_example/ @elastic/kibana-reporting-services @elastic/kibana-app-services +/x-pack/examples/screenshotting_example/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/plugins/reporting/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/test/functional/apps/dashboard/reporting/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/test/functional/apps/reporting/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/test/functional/apps/reporting_management/ @elastic/kibana-reporting-services @elastic/kibana-app-services +/x-pack/test/examples/screenshotting/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/test/functional/es_archives/lens/reporting/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/test/functional/es_archives/reporting/ @elastic/kibana-reporting-services @elastic/kibana-app-services /x-pack/test/functional/fixtures/kbn_archiver/reporting/ @elastic/kibana-reporting-services @elastic/kibana-app-services @@ -484,6 +630,7 @@ x-pack/plugins/session_view @elastic/awp-platform ## Shared UX /src/plugins/shared_ux/ @elastic/shared-ux +/packages/shared-ux/ @elastic/shared-ux /packages/shared-ux-*/ @elastic/shared-ux /src/plugins/kibana_react/ @elastic/shared-ux /src/plugins/kibana_react/public/code_editor @elastic/shared-ux @elastic/kibana-presentation diff --git a/.gitignore b/.gitignore index 588c185b17a0b..7c20367dfe6de 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ node_modules !/src/dev/npm/integration_tests/__fixtures__/fixture1/node_modules !/src/dev/notice/__fixtures__/node_modules +!/packages/kbn-import-resolver/src/__fixtures__/node_modules trash /optimize /built_assets @@ -98,4 +99,5 @@ elastic-agent-* fleet-server-* elastic-agent.yml fleet-server.yml +/packages/kbn-synthetic-package-map/synthetic-packages.json diff --git a/.i18nrc.json b/.i18nrc.json index 573462d497438..a5d1b36ede73d 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -66,6 +66,7 @@ "share": "src/plugins/share", "sharedUX": "src/plugins/shared_ux", "sharedUXComponents": "packages/kbn-shared-ux-components/src", + "sharedUXPackages": "packages/shared-ux", "coloring": "packages/kbn-coloring/src", "statusPage": "src/legacy/core_plugins/status_page", "telemetry": [ diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index ff9014214d4c0..891389d803a56 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -10,14 +10,12 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") # Fetch Node.js rules http_archive( name = "build_bazel_rules_nodejs", - sha256 = "523da2d6b50bc00eaf14b00ed28b1a366b3ab456e14131e9812558b26599125c", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.3.1/rules_nodejs-5.3.1.tar.gz"], + patch_args = ["-p1"], + patches = ["//:src/dev/bazel/rules_nodejs_patches/normalized_paths_for_windows_runfiles.patch"], + sha256 = "6f15d75f9e99c19d9291ff8e64e4eb594a6b7d25517760a75ad3621a7a48c2df", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.7.0/rules_nodejs-4.7.0.tar.gz"], ) -# Build Node.js rules dependencies -load("@build_bazel_rules_nodejs//:repositories.bzl", "build_bazel_rules_nodejs_dependencies") -build_bazel_rules_nodejs_dependencies() - # Now that we have the rules let's import from them to complete the work load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") @@ -39,7 +37,7 @@ node_repositories( node_urls = [ "https://nodejs.org/dist/v{version}/{filename}", ], - yarn_releases = { + yarn_repositories = { "1.21.1": ("yarn-v1.21.1.tar.gz", "yarn-v1.21.1", "d1d9f4a0f16f5ed484e814afeb98f39b82d4728c6c8beaafb5abc99c02db6674"), }, yarn_version = "1.21.1", diff --git a/dev_docs/tutorials/screenshotting.mdx b/dev_docs/tutorials/screenshotting.mdx new file mode 100644 index 0000000000000..76f2859928491 --- /dev/null +++ b/dev_docs/tutorials/screenshotting.mdx @@ -0,0 +1,87 @@ +--- +id: kibDevTutorialScreenshotting +slug: /kibana-dev-docs/tutorials/screenshotting +title: Kibana Screenshotting Service +summary: Kibana Screenshotting Service +date: 2022-04-12 +tags: ['kibana', 'onboarding', 'dev', 'architecture'] +--- + +## Screenshotting Plugin + +This plugin provides functionality to take screenshots of the Kibana pages. +It uses Chromium and Puppeteer underneath to run the browser in headless mode. + +If you are planning to integrate with the screenshotting plugin, please get in touch with the App Services team to know all the limitations. + +### Capabilities +- Canvas workpads screenshots. +- Dashboards screenshots. +- Expressions screenshots. +- PDF generation. +- Batch screenshotting. + +### Usage +After listing the `screenshotting` plugin in your dependencies, the plugin will be intitalized on the setup stage. +The intitalization process downloads (if it is not already present) and verifies the Chromium build. + +The start contract exposes a public API to interact with the plugin. +Apart from the actual screenshotting functionality, it also provides a way for self-diagnostics. + +Here is an example of how you can take a screenshot of a Kibana URL. + + +```typescript +import { lastValueFrom } from 'rxjs'; +import type { CoreSetup, Plugin } from 'src/core/server'; +import type { ScreenshottingStart } from 'x-pack/plugins/screenshotting/server'; + + +interface StartDeps { + screenshotting: ScreenshottingStart; +} + +class ExamplePlugin implements Plugin { + setup({ http, getStartServices }: CoreSetup) { + const router = http.createRouter(); + + router.get( + { + path: '/api/capture', + validate: { + query: schema.object({ + id: schema.string(), + }), + }, + }, + async (context, request, response) => { + const [, { screenshotting }] = await getStartServices(); + const { metrics, results } = await lastValueFrom( + screenshotting.getScreenshots({ + request, + urls: [`http://localhost/app/canvas#/workpad/workpad-${request.query.id}`], + }) + ); + + return response.ok({ + body: JSON.stringify({ + metrics, + image: results[0]?.screenshots[0]?.data.toString('base64'), + errors: results[0]?.renderErrors, + } as ScreenshottingExpressionResponse), + }); + } + ); + } + + start() {} +} + +export function plugin() { + return new ExamplePlugin(); +} +``` + + + Check the complete API reference . + diff --git a/docs/api/cases.asciidoc b/docs/api/cases.asciidoc index 3b5bfaeceaff4..9ffe69997f714 100644 --- a/docs/api/cases.asciidoc +++ b/docs/api/cases.asciidoc @@ -8,22 +8,22 @@ these APIs: * <> * <> * <> -* {security-guide}/cases-api-find-alert.html[Find all alerts attached to a case] * <> -* {security-guide}/cases-api-find-cases-by-alert.html[Find cases by alert] * <> +* <> * <> * <> * <> +* <> * <> -* {security-guide}/cases-get-connector.html[Get current connector] +* <> * <> * <> -* {security-guide}/cases-api-push.html[Push case] -* {security-guide}/assign-connector.html[Set default Elastic Security UI connector] -* {security-guide}/case-api-update-connector.html[Update case configurations] +* <> +* <> * <> * <> +* <> //ADD include::cases/cases-api-add-comment.asciidoc[leveloffset=+1] @@ -36,12 +36,20 @@ include::cases/cases-api-delete-comments.asciidoc[leveloffset=+1] include::cases/cases-api-find-cases.asciidoc[leveloffset=+1] include::cases/cases-api-find-connectors.asciidoc[leveloffset=+1] //GET +include::cases/cases-api-get-alerts.asciidoc[leveloffset=+1] include::cases/cases-api-get-case-activity.asciidoc[leveloffset=+1] include::cases/cases-api-get-case.asciidoc[leveloffset=+1] include::cases/cases-api-get-status.asciidoc[leveloffset=+1] +include::cases/cases-api-get-cases-by-alert.asciidoc[leveloffset=+1] include::cases/cases-api-get-comments.asciidoc[leveloffset=+1] +include::cases/cases-api-get-configuration.asciidoc[leveloffset=+1] include::cases/cases-api-get-reporters.asciidoc[leveloffset=+1] include::cases/cases-api-get-tags.asciidoc[leveloffset=+1] +//PUSH +include::cases/cases-api-push.asciidoc[leveloffset=+1] +//SET +include::cases/cases-api-set-configuration.asciidoc[leveloffset=+1] //UPDATE include::cases/cases-api-update.asciidoc[leveloffset=+1] include::cases/cases-api-update-comment.asciidoc[leveloffset=+1] +include::cases/cases-api-update-configuration.asciidoc[leveloffset=+1] diff --git a/docs/api/cases/cases-api-get-alerts.asciidoc b/docs/api/cases/cases-api-get-alerts.asciidoc new file mode 100644 index 0000000000000..62bca2d38ae8f --- /dev/null +++ b/docs/api/cases/cases-api-get-alerts.asciidoc @@ -0,0 +1,60 @@ +[[cases-api-get-alerts]] +== Get alerts attached to case API +++++ +Get alerts +++++ + +preview::[] + +Gets all alerts attached to a case. + +=== {api-request-title} + +`GET :/api/cases//alerts` + +`GET :/s//api/cases//alerts` + +=== {api-prereq-title} + +You must have `read` privileges for the *Cases* feature in the *Management*, +*{observability}*, or *Security* section of the +<>, depending on the +`owner` of the cases you're seeking. + +=== {api-path-parms-title} + +``:: +(Required, string) The identifier for the case. To retrieve case IDs, use +<>. + +``:: +(Optional, string) An identifier for the space. If it is not specified, the +default space is used. + +=== {api-response-codes-title} + +`200`:: + Indicates a successful call. + +=== {api-example-title} + +Return all alerts attached to case `293f1bc0-74f6-11ea-b83a-553aecdb28b6`: + +[source,sh] +-------------------------------------------------- +GET api/cases/293f1bc0-74f6-11ea-b83a-553aecdb28b6/alerts +-------------------------------------------------- +// KIBANA + +The API returns a JSON array listing the alerts. For example: + +[source,json] +-------------------------------------------------- +[ + { + "id": "09f0c261e39e36351d75995b78bb83673774d1bc2cca9df2d15f0e5c0a99a540", + "index": ".internal.alerts-security.alerts-default-000001", + "attached_at": "2022-04-13T21:35:24.602Z" + } +] +-------------------------------------------------- diff --git a/docs/api/cases/cases-api-get-cases-by-alert.asciidoc b/docs/api/cases/cases-api-get-cases-by-alert.asciidoc new file mode 100644 index 0000000000000..fb1f7c625c5fc --- /dev/null +++ b/docs/api/cases/cases-api-get-cases-by-alert.asciidoc @@ -0,0 +1,72 @@ +[[cases-api-get-cases-by-alert]] +== Get cases by alert API +++++ +Get cases by alert +++++ + +preview::[] + +Returns the cases associated with a specific alert. + +=== {api-request-title} + +`GET :/api/cases/alerts/` + +`GET :/s//api/cases/alerts/` + +=== {api-prereq-title} + +You must have `read` privileges for the *Cases* feature in the *Management*, +*{observability}*, or *Security* section of the +<>, depending on the +`owner` of the cases you're seeking. + +=== {api-path-parms-title} + +``:: +(Required, string) The alert identifier. + +``:: +(Optional, string) An identifier for the space. If it is not specified, the +default space is used. + +=== {api-query-parms-title} + +`owner`:: +(Optional, string or array of strings) A filter to limit the retrieved cases to +a specific set of applications. Valid values are: `cases`, `observability`, +and `securitySolution`. If this parameter is omitted, the response contains all +cases that the user has access to read. + +=== {api-response-codes-title} + +`200`:: + Indicates a successful call. + +=== {api-example-title} + +Return cases associated with the alert ID +`09f0c261e39e36351d75995b78bb83673774d1bc2cca9df2d15f0e5c0a99a540`: + +[source,sh] +-------------------------------------------------- +GET api/cases/alerts/09f0c261e39e36351d75995b78bb83673774d1bc2cca9df2d15f0e5c0a99a540 +-------------------------------------------------- +// KIBANA + +The API returns a JSON array containing the identifier and title of the cases. +For example: + +[source,json] +-------------------------------------------------- +[ + { + "id": "8af6ac20-74f6-11ea-b83a-553aecdb28b6", + "title": "Case 1" + }, + { + "id": "a18b38a0-71b0-11ea-a0b2-c51ea50a58e2", + "title": "Case 2" + } +] +-------------------------------------------------- \ No newline at end of file diff --git a/docs/api/cases/cases-api-get-configuration.asciidoc b/docs/api/cases/cases-api-get-configuration.asciidoc new file mode 100644 index 0000000000000..778e95949e3f5 --- /dev/null +++ b/docs/api/cases/cases-api-get-configuration.asciidoc @@ -0,0 +1,95 @@ +[[cases-get-configuration]] +== Get case configuration API +++++ +Get configuration +++++ + +Retrieves external connection details, such as the closure type and +default connector for cases. + +=== {api-request-title} + +`GET :/api/cases/configure` + +`GET :/s//api/cases/configure` + +=== {api-prereq-title} + +You must have `read` privileges for the *Cases* feature in the *Management*, +*{observability}*, or *Security* section of the +<>, depending on the +`owner` of the case configuration. + +=== {api-path-parms-title} + +``:: +(Optional, string) An identifier for the space. If it is not specified, the +default space is used. + +=== {api-query-parms-title} + +`owner`:: +(Optional, string or array of strings) A filter to limit the retrieved +details to a specific set of applications. Valid values are: `cases`, +`observability`, and `securitySolution`. If this parameter is omitted, the +response contains information for all applications that the user has access to +read. + +=== Response code + +`200`:: + Indicates a successful call. + +=== Example + +[source,sh] +-------------------------------------------------- +GET api/cases/configure?owner=securitySolution +-------------------------------------------------- +// KIBANA + +The API returns the following type of information: + +[source,json] +-------------------------------------------------- +[ + { + "owner": "securitySolution", + "closure_type": "close-by-user", + "created_at": "2020-03-30T13:31:38.083Z", + "created_by": { + "email": "admin@hms.gov.uk", + "full_name": "Mr Admin", + "username": "admin" + }, + "updated_at": null, + "updated_by": null, + "connector": { + "id": "131d4448-abe0-4789-939d-8ef60680b498", + "name": "my-jira", + "type": ".jira", + "fields": null + }, + "mappings": [ + { + "source": "title", + "target": "summary", + "action_type": "overwrite" + }, + { + "source": "description", + "target": "description", + "action_type": "overwrite" + }, + { + "source": "comments", + "target": "comments", + "action_type": "append" + } + ], + "version": "WzE3NywxXQ==", + "error": null, + "id": "7349772f-421a-4de3-b8bb-2d9b22ccee30" + } +] +-------------------------------------------------- diff --git a/docs/api/cases/cases-api-get-tags.asciidoc b/docs/api/cases/cases-api-get-tags.asciidoc index 426a7e91a0f47..44d2bf9fffd1f 100644 --- a/docs/api/cases/cases-api-get-tags.asciidoc +++ b/docs/api/cases/cases-api-get-tags.asciidoc @@ -4,7 +4,7 @@ Get tags ++++ -Aggregates and returns all unique tags from all cases. +Aggregates and returns a list of case tags. === Request @@ -21,10 +21,6 @@ You must have `read` privileges for the *Cases* feature in the *Management*, === Path parameters -``:: -(Required, string) An identifier for the case to retrieve. Use -<> to retrieve case IDs. - ``:: (Optional, string) An identifier for the space. If it is not specified, the default space is used. @@ -32,9 +28,9 @@ default space is used. === Query parameters `owner`:: -(Optional, string or array of strings) Specifies the set of applications to -limit the retrieved tags. If not specified, the response contains all tags from -cases that the user has access to read. +(Optional, string or array of strings) A filter to limit the retrieved tags to a specific set of applications. +Valid values are: `cases`, `observability`, and `securitySolution`. If this parameter is omitted, the response +contains tags from all cases that the user has access to read. ==== Response code @@ -43,16 +39,13 @@ cases that the user has access to read. ==== Example -Gets all tags for all cases: - [source,sh] -------------------------------------------------- GET api/cases/tags -------------------------------------------------- // KIBANA -The API returns a JSON object with the names and email addresses of users who -opened cases. For example: +The API returns a JSON object with tags from all the cases that the user has access to read. For example: [source,json] -------------------------------------------------- @@ -62,4 +55,4 @@ opened cases. For example: "social engineering", "bubblegum" ] --------------------------------------------------- \ No newline at end of file +-------------------------------------------------- diff --git a/docs/api/cases/cases-api-push.asciidoc b/docs/api/cases/cases-api-push.asciidoc new file mode 100644 index 0000000000000..e837dc78ad1a4 --- /dev/null +++ b/docs/api/cases/cases-api-push.asciidoc @@ -0,0 +1,110 @@ +[[cases-api-push]] +== Push case API +++++ +Push case +++++ + +Pushes a case to an external service. + +=== {api-request-title} + +`POST :/api/cases//connector//_push` + +`POST :/s//api/cases//connector//_push` + +=== {api-prereq-title} + +You must have `all` privileges for the *Actions and Connectors* feature in the +*Management* section of the +<>. You must also have `all` +privileges for the *Cases* feature in the *Management*, *{observability}*, or +*Security* section of the {kib} feature privileges, depending on the +`owner` of the case you're pushing. + +=== {api-path-parms-title} + +``:: +(Required, string) The identifier for the case. To retrieve case IDs, use +<>. + +``:: +(Required, string) The identifier for the connector. To retrieve connector IDs, +use <>. + +:: +(Optional, string) An identifier for the space. If it is not specified, the +default space is used. + +=== {api-response-codes-title} + +`200`:: + Indicates a successful call. + +=== {api-example-title} + +Push the case to an external service: + +[source,sh] +-------------------------------------------------- +POST api/cases/7349772f-421a-4de3-b8bb-2d9b22ccee30/connector/abed3a70-71bd-11ea-a0b2-c51ea50a58e2/_push +{} +-------------------------------------------------- +// KIBANA + +The API returns a JSON object representing the pushed case. For example: + +[source,json] +-------------------------------------------------- +{ + "id": "a18b38a0-71b0-11ea-a0b2-c51ea50a58e2", + "version": "Wzk4LDFd", + "comments": [], + "totalComment": 0, + "totalAlerts": 0, + "title": "This case will self-destruct in 5 seconds", + "tags": [ "phishing", "social engineering", "bubblegum" ], + "description": "James Bond clicked on a highly suspicious email banner advertising cheap holidays for underpaid civil servants. Operation bubblegum is active. Repeat - operation bubblegum is now active!", + "settings": { + "syncAlerts": true + }, + "owner": "securitySolution", + "closed_at": null, + "closed_by": null, + "created_at": "2022-03-29T11:30:02.658Z", + "created_by": { + "email": "ahunley@imf.usa.gov", + "full_name": "Alan Hunley", + "username": "ahunley" + }, + "status": "open", + "updated_at": "2022-03-29T12:01:50.244Z", + "updated_by": { + "full_name": "Classified", + "email": "classified@hms.oo.gov.uk", + "username": "M" + }, + "connector": { + "id": "08046500-bb7b-11ec-89c3-ef74ed34b2e9", + "name": "My connector", + "type": ".jira", + "fields": { + "issueType": "10006", + "priority": "High", + "parent": null + } + }, + "external_service": { + "pushed_at":"2022-07-26T18:19:43.688Z", + "pushed_by":{ + "username":"classified@hms.oo.gov.uk", + "full_name":null, + "email":null + }, + "connector_name":"My connector", + "external_id":"10110", + "external_title":"TPN-103", + "external_url":"https://cases.jira.com", + "connector_id":"08046500-bb7b-11ec-89c3-ef74ed34b2e9", + } +} +-------------------------------------------------- diff --git a/docs/api/cases/cases-api-set-configuration.asciidoc b/docs/api/cases/cases-api-set-configuration.asciidoc new file mode 100644 index 0000000000000..2b0cbefc008ac --- /dev/null +++ b/docs/api/cases/cases-api-set-configuration.asciidoc @@ -0,0 +1,163 @@ +[[cases-api-set-configuration]] +== Set case configuration API +++++ +Set configuration +++++ + +Sets external connection details, such as the closure type and +default connector for cases. + +=== {api-request-title} + +`POST :/api/cases/configure` + +`POST :/s//api/cases/configure` + +=== {api-prereq-title} + +You must have `all` privileges for the *Cases* feature in the *Management*, +*{observability}*, or *Security* section of the +<>, depending on the +`owner` of the case configuration. + +=== {api-description-title} + +Connectors are used to interface with external systems. You must create a +connector before you can use it in your cases. Refer to <>. + +If you set a default connector, it is automatically selected when you create +cases in {kib}. If you use the <>, however, +you must still specify all of the connector details. + +=== {api-path-parms-title} + +``:: +(Optional, string) An identifier for the space. If it is not specified, the +default space is used. + +=== {api-request-body-title} + +`closure_type`:: +(Required, string) Specifies whether a case is automatically closed when it is +pushed to external systems. ++ +-- +Valid values are: + +* `close-by-pushing`: Cases are automatically closed when they are pushed. +* `close-by-user`: Cases are not automatically closed. +-- + +`connector`:: +(Required, object) An object that contains the connector configuration. ++ +.Properties of `connector` +[%collapsible%open] +==== +`fields`:: +(Required, object) An object that contains the connector fields. ++ +-- +TIP: The fields specified in the case configuration are not used and are not +propagated to individual cases, therefore it is recommended to set it to `null`. +-- + +`id`:: +(Required, string) The identifier for the connector. If you do not want a +default connector, use `none`. To retrieve connector IDs, use +<>. + +`name`:: +(Required, string) The name of the connector. If you do not want a default +connector, use `none`. To retrieve connector names, use +<>. + +`type`:: +(Required, string) The type of the connector. Valid values are: `.jira`, `.none`, +`.resilient`,`.servicenow`, `.servicenow-sir`, and `.swimlane`. +==== + +`owner`:: +(Required, string) The application that owns the case configuration. Valid +values are: `cases`, `observability`, or `securitySolution`. This value affects +whether you're setting case configuration details for {stack-manage-app}, +{observability}, or {security-app}. + +`settings`:: +(Optional, object) +An object that contains the case settings. ++ +.Properties of `settings` +[%collapsible%open] +==== +`syncAlerts`:: +(Required, boolean) Turns alert syncing on or off. +==== + +=== {api-response-codes-title} + +`200`:: + Indicates a successful call. + +=== {api-example-title} + +Sets the closure type and default connector for cases in **{stack-manage-app}**: + +[source,sh] +-------------------------------------------------- +POST api/cases/configure +{ + "owner": "cases", + "connector": { + "id": "131d4448-abe0-4789-939d-8ef60680b498", + "name": "my-serviceNow", + "type": ".servicenow", + "fields": null, + }, + "closure_type": "close-by-user" +} +-------------------------------------------------- + +The API returns the following response: + +[source,json] +-------------------------------------------------- +{ + "owner": "cases", + "closure_type": "close-by-user", + "created_at": "2022-04-02T01:09:02.303Z", + "created_by": { + "email": "moneypenny@hms.gov.uk", + "full_name": "Ms Moneypenny", + "username": "moneypenny" + }, + "updated_at": null, + "updated_by": null, + "connector": { + "id": "131d4448-abe0-4789-939d-8ef60680b498", + "name": "my-serviceNow", + "type": ".servicenow", + "fields": null, + }, + "mappings": [ + { + "source": "title", + "target": "short_description", + "action_type": "overwrite" + }, + { + "source":"description", + "target":"description", + "action_type":"overwrite" + }, + { + "source":"comments", + "target":"work_notes", + "action_type":"append" + } + ], + "version": "WzE3NywxXQ==", + "error": null, + "id": "7349772f-421a-4de3-b8bb-2d9b22ccee30", +} +-------------------------------------------------- diff --git a/docs/api/cases/cases-api-update-configuration.asciidoc b/docs/api/cases/cases-api-update-configuration.asciidoc new file mode 100644 index 0000000000000..cf7d2ea7d8cfd --- /dev/null +++ b/docs/api/cases/cases-api-update-configuration.asciidoc @@ -0,0 +1,129 @@ +[[cases-api-update-configuration]] +== Update case configuration API +++++ +Update configuration +++++ + +Updates external connection details, such as the closure type and default +connector for cases. + +=== {api-request-title} + +`PATCH :/api/cases/configure/` + +`PATCH :/s//api/cases/configure/` + +=== {api-prereq-title} + +You must have `all` privileges for the *Cases* feature in the *Management*, +*{observability}*, or *Security* section of the +<>, depending on the +`owner` of the case configuration. + +=== {api-description-title} + +Connectors are used to interface with external systems. You must create a +connector before you can it in your cases. Refer to <>. + +=== {api-path-parms-title} + +``:: +The identifier for the configuration. To retrieve the configuration IDs, use +<>. + +``:: +(Optional, string) An identifier for the space. If it is not specified, the +default space is used. + +=== Request body + +`closure_type`:: +(Optional, string) Determines whether a case is automatically closed when it is +pushed to external systems. Valid values are: ++ +-- +* `close-by-pushing`: Cases are automatically closed when they +are pushed. +* `close-by-user`: Cases are not automatically closed. +-- + +`connector`:: +(Optional, object) An object that contains the connector configuration. ++ +.Properties of `connector` +[%collapsible%open] +==== +`fields`:: +(Required, object) An object that contains the connector fields. ++ +-- +TIP: The fields specified in the case configuration are not used and are not +propagated to individual cases, therefore it is recommended to set it to `null`. +-- + +`id`:: +(Required, string) The identifier for the connector. To retrieve connector IDs, +use <>. + +`name`:: +(Required, string) The name of the connector. + +`type`:: +(Required, string) The type of the connector. Valid values are: `.servicenow`, +`.servicenow-sir`, `.jira`, `.resilient`, `.swimlane`, and `.none`. +==== + +`version`:: +(Required, string) The version of the connector. To retrieve the version value, +use <>. + +=== Response code + +`200`:: + Indicates a successful call. + +=== Example + +Change the closure type configuration option: + +[source,sh] +-------------------------------------------------- +PATCH api/cases/configure/3297a0f0-b5ec-11ec-b141-0fdb20a7f9a9 +{ + "closure_type": "close-by-pushing", + "version": "WzIwMiwxXQ==" +} +-------------------------------------------------- +// KIBANA + +The API returns the following: + +[source,json] +-------------------------------------------------- +{ + "closure_type": "close-by-user", + "owner": "cases", + "created_at": "2022-04-06T20:57:40.746Z", + "created_by": { + "email": "admin@hms.gov.uk", + "full_name": "Ms Admin", + "username": "admin" + }, + "updated_at": "2022-04-12T22:41:09.262Z", + "updated_by": { + "email": "admin@hms.gov.uk", + "full_name": "Ms Admin", + "username": "admin" + }, + "connector": { + "id": "none", + "name": "none", + "type": ".none", + "fields": null + }, + "mappings": [], + "version": "WzkwNiw1XQ==", + "error": null, + "id": "3297a0f0-b5ec-11ec-b141-0fdb20a7f9a9" +} +-------------------------------------------------- diff --git a/docs/api/data-views/update-fields.asciidoc b/docs/api/data-views/update-fields.asciidoc index babe689ce6b23..3ec4b7c84694a 100644 --- a/docs/api/data-views/update-fields.asciidoc +++ b/docs/api/data-views/update-fields.asciidoc @@ -49,7 +49,7 @@ Set popularity `count` for field `foo`: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/data-view/my-view/fields +$ curl -X POST api/data_views/data-view/my-view/fields { "fields": { "foo": { @@ -64,7 +64,7 @@ Update multiple metadata fields in one request: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/data-view/my-view/fields +$ curl -X POST api/data_views/data-view/my-view/fields { "fields": { "foo": { @@ -82,7 +82,7 @@ $ curl -X POST api/saved_objects/data-view/my-view/fields Use `null` value to delete metadata: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/data-view/my-pattern/fields +$ curl -X POST api/data_views/data-view/my-pattern/fields { "fields": { "foo": { diff --git a/docs/api/data-views/update.asciidoc b/docs/api/data-views/update.asciidoc index b86a13682cb0b..c1473b8f7079b 100644 --- a/docs/api/data-views/update.asciidoc +++ b/docs/api/data-views/update.asciidoc @@ -61,7 +61,7 @@ Update a title of the `` data view: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/data-view/my-view +$ curl -X POST api/data_views/data-view/my-view { "data_view": { "title": "some-other-view-*" @@ -74,7 +74,7 @@ Customize the update behavior: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/data-view/my-view +$ curl -X POST api/data_views/data-view/my-view { "refresh_fields": true, "data_view": { @@ -89,7 +89,7 @@ All update fields are optional, but you can specify the following fields: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/data-view/my-view +$ curl -X POST api/data_views/data-view/my-view { "data_view": { "title": "...", diff --git a/docs/api/index-patterns/update-fields.asciidoc b/docs/api/index-patterns/update-fields.asciidoc index e3ac304745f39..e2655d557e929 100644 --- a/docs/api/index-patterns/update-fields.asciidoc +++ b/docs/api/index-patterns/update-fields.asciidoc @@ -46,7 +46,7 @@ Set popularity `count` for field `foo`: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields +$ curl -X POST api/index_patterns/index-pattern/my-pattern/fields { "fields": { "foo": { @@ -61,7 +61,7 @@ Update multiple metadata fields in one request: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields +$ curl -X POST api/index_patterns/index-pattern/my-pattern/fields { "fields": { "foo": { @@ -79,7 +79,7 @@ $ curl -X POST api/saved_objects/index-pattern/my-pattern/fields Use `null` value to delete metadata: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern/fields +$ curl -X POST api/index_patterns/index-pattern/my-pattern/fields { "fields": { "foo": { diff --git a/docs/api/index-patterns/update.asciidoc b/docs/api/index-patterns/update.asciidoc index 366afd336d15a..64479f00ef5c5 100644 --- a/docs/api/index-patterns/update.asciidoc +++ b/docs/api/index-patterns/update.asciidoc @@ -58,7 +58,7 @@ Update a title of the `` index pattern: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern +$ curl -X POST api/index_patterns/index-pattern/my-pattern { "index_pattern": { "title": "some-other-pattern-*" @@ -71,7 +71,7 @@ Customize the update behavior: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern +$ curl -X POST api/index_patterns/index-pattern/my-pattern { "refresh_fields": true, "index_pattern": { @@ -86,7 +86,7 @@ All update fields are optional, but you can specify the following fields: [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern +$ curl -X POST api/index_patterns/index-pattern/my-pattern { "index_pattern": { "title": "...", diff --git a/docs/api/saved-objects/create.asciidoc b/docs/api/saved-objects/create.asciidoc index d250b0602adb7..73339946ea0c0 100644 --- a/docs/api/saved-objects/create.asciidoc +++ b/docs/api/saved-objects/create.asciidoc @@ -72,7 +72,7 @@ used to specify a single space, and the "All spaces" identifier (`'*'`) is not a [source,sh] -------------------------------------------------- -$ curl -X POST api/saved_objects/index-pattern/my-pattern -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' +$ curl -X POST api/index_patterns/index-pattern/my-pattern -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d ' { "attributes": { "title": "my-pattern-*" diff --git a/docs/api/saved-objects/delete.asciidoc b/docs/api/saved-objects/delete.asciidoc index eca46e202beda..6cc31b6563aa3 100644 --- a/docs/api/saved-objects/delete.asciidoc +++ b/docs/api/saved-objects/delete.asciidoc @@ -47,6 +47,6 @@ Delete {a-data-source} object with the `my-pattern` ID: [source,sh] -------------------------------------------------- -$ curl -X DELETE api/saved_objects/index-pattern/my-pattern +$ curl -X DELETE api/index_patterns/index-pattern/my-pattern -------------------------------------------------- // KIBANA diff --git a/docs/api/saved-objects/get.asciidoc b/docs/api/saved-objects/get.asciidoc index 174587b400993..3f4b6037cd806 100644 --- a/docs/api/saved-objects/get.asciidoc +++ b/docs/api/saved-objects/get.asciidoc @@ -39,7 +39,7 @@ Retrieve the {data-source} object with the `my-pattern` ID: [source,sh] -------------------------------------------------- -$ curl -X GET api/saved_objects/index-pattern/my-pattern +$ curl -X GET api/index_patterns/index-pattern/my-pattern -------------------------------------------------- // KIBANA diff --git a/docs/api/saved-objects/update.asciidoc b/docs/api/saved-objects/update.asciidoc index fb7decccabd4c..0559c49625fee 100644 --- a/docs/api/saved-objects/update.asciidoc +++ b/docs/api/saved-objects/update.asciidoc @@ -58,7 +58,7 @@ Update an existing {data-source} object,`my-pattern`, with a different title: [source,sh] -------------------------------------------------- -$ curl -X PUT api/saved_objects/index-pattern/my-pattern +$ curl -X PUT api/index_patterns/index-pattern/my-pattern { "attributes": { "title": "some-other-pattern-*" diff --git a/docs/developer/getting-started/monorepo-packages.asciidoc b/docs/developer/getting-started/monorepo-packages.asciidoc index 0216d26023a78..eed060d253a28 100644 --- a/docs/developer/getting-started/monorepo-packages.asciidoc +++ b/docs/developer/getting-started/monorepo-packages.asciidoc @@ -57,7 +57,6 @@ yarn kbn watch - @kbn/analytics - @kbn/apm-config-loader - @kbn/apm-utils -- @kbn/babel-code-parser - @kbn/babel-preset - @kbn/cli-dev-mode - @kbn/config diff --git a/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md b/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md index 91cb6c370d759..d5ba98c06ef02 100644 --- a/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md +++ b/docs/development/core/server/kibana-plugin-core-server.kibanaresponsefactory.md @@ -34,7 +34,7 @@ kibanaResponseFactory: { message: string | Error; attributes?: ResponseErrorAttributes | undefined; }>; - customError: (options: CustomHttpResponseOptions) => KibanaResponse) => KibanaResponse; diff --git a/docs/discover/document-explorer.asciidoc b/docs/discover/document-explorer.asciidoc index de7b07aa4d784..e0cead0292cf3 100644 --- a/docs/discover/document-explorer.asciidoc +++ b/docs/discover/document-explorer.asciidoc @@ -1,10 +1,11 @@ [[document-explorer]] -== Document Explorer +== Explore your documents -beta::[] -*Discover* has a *Document Explorer* with resizable columns, better data sorting and comparison, -and a fullscreen view. +*Discover* displays your documents in table format, so you can +best explore your data. +Use the document table to resize columns, set row height, +perform multi-column sorting, compare data, and more. ++++