Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into rules-page-on-week
Browse files Browse the repository at this point in the history
  • Loading branch information
dplumlee committed Sep 4, 2024
2 parents 78588e9 + 0c8dd0a commit f409076
Show file tree
Hide file tree
Showing 2,151 changed files with 38,131 additions and 30,709 deletions.
4 changes: 1 addition & 3 deletions .buildkite/ftr_oblt_serverless_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ disabled:
- x-pack/test_serverless/functional/test_suites/observability/cypress/config_headless.ts
- x-pack/test_serverless/functional/test_suites/observability/cypress/config_runner.ts

# Serverless feature flag config files (move to enabled after tests are added)
- x-pack/test_serverless/functional/test_suites/observability/config.feature_flags.ts

defaultQueue: 'n2-4-spot'
enabled:
- x-pack/test_serverless/api_integration/test_suites/observability/config.ts
Expand All @@ -17,6 +14,7 @@ enabled:
- x-pack/test_serverless/api_integration/test_suites/observability/fleet/config.ts
- x-pack/test_serverless/functional/test_suites/observability/config.ts
- x-pack/test_serverless/functional/test_suites/observability/config.examples.ts
- x-pack/test_serverless/functional/test_suites/observability/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/observability/config.saved_objects_management.ts
- x-pack/test_serverless/functional/test_suites/observability/config.context_awareness.ts
- x-pack/test_serverless/functional/test_suites/observability/common_configs/config.group1.ts
Expand Down
2 changes: 2 additions & 0 deletions .buildkite/ftr_search_serverless_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ disabled:
defaultQueue: 'n2-4-spot'
enabled:
- x-pack/test_serverless/api_integration/test_suites/search/config.ts
- x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts
- x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts
- x-pack/test_serverless/functional/test_suites/search/config.ts
- x-pack/test_serverless/functional/test_suites/search/config.examples.ts
- x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/search/config.screenshots.ts
- x-pack/test_serverless/functional/test_suites/search/config.saved_objects_management.ts
- x-pack/test_serverless/functional/test_suites/search/config.context_awareness.ts
Expand Down
9 changes: 2 additions & 7 deletions .buildkite/ftr_security_serverless_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,16 @@ disabled:
- x-pack/test_serverless/functional/config.base.ts
- x-pack/test_serverless/shared/config.base.ts

# Serverless feature flag config files (move to enabled after tests are added)
- x-pack/test_serverless/functional/test_suites/observability/config.feature_flags.ts
- x-pack/test_serverless/api_integration/test_suites/search/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/search/config.feature_flags.ts
- x-pack/test_serverless/api_integration/test_suites/security/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/security/config.feature_flags.ts

defaultQueue: 'n2-4-spot'
enabled:
- x-pack/test_serverless/api_integration/test_suites/security/config.ts
- x-pack/test_serverless/api_integration/test_suites/security/config.feature_flags.ts
- x-pack/test_serverless/api_integration/test_suites/security/common_configs/config.group1.ts
- x-pack/test_serverless/api_integration/test_suites/security/fleet/config.ts
- x-pack/test_serverless/functional/test_suites/security/config.screenshots.ts
- x-pack/test_serverless/functional/test_suites/security/config.ts
- x-pack/test_serverless/functional/test_suites/security/config.examples.ts
- x-pack/test_serverless/functional/test_suites/security/config.feature_flags.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.basic.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.essentials.ts
- x-pack/test_serverless/functional/test_suites/security/config.cloud_security_posture.agentless.ts
Expand Down
11 changes: 8 additions & 3 deletions .buildkite/scripts/common/setup_job_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ if [[ "$(type -t vault_get)" != "function" ]]; then
source .buildkite/scripts/common/vault_fns.sh
fi

source .buildkite/scripts/common/util.sh

# Set up general-purpose tokens and credentials
{
BUILDKITE_TOKEN="$(vault_get buildkite-ci buildkite_token_all_jobs)"
Expand All @@ -18,9 +20,12 @@ fi

KIBANA_DOCKER_USERNAME="$(vault_get container-registry username)"
KIBANA_DOCKER_PASSWORD="$(vault_get container-registry password)"
if (command -v docker && docker version) &> /dev/null; then
echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
fi
function docker_login() {
if (command -v docker && docker version) &> /dev/null; then
echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
fi
}
retry 5 15 docker_login
}

# Set up a custom ES Snapshot Manifest if one has been specified for this build
Expand Down
29 changes: 29 additions & 0 deletions .buildkite/scripts/common/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,32 @@ print_if_dry_run() {
echo "DRY_RUN is enabled."
fi
}

docker_with_retry () {
cmd=$1
shift
args=("$@")
attempt=0
max_retries=5
sleep_time=15

while true
do
attempt=$((attempt+1))

if [ $attempt -gt $max_retries ]
then
echo "Docker $cmd retries exceeded, aborting."
exit 1
fi

if docker "$cmd" "${args[@]}"
then
echo "Docker $cmd successful."
break
else
echo "Docker $cmd unsuccessful, attempt '$attempt'... Retrying in $sleep_time"
sleep $sleep_time
fi
done
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fi
.buildkite/scripts/bootstrap.sh

source .buildkite/scripts/steps/artifacts/env.sh
source .buildkite/scripts/common/util.sh

GIT_ABBREV_COMMIT=${BUILDKITE_COMMIT:0:12}
KIBANA_IMAGE_TAG="sec-sol-qg-$GIT_ABBREV_COMMIT"
Expand All @@ -23,7 +24,7 @@ if docker manifest inspect $KIBANA_IMAGE &> /dev/null; then
exit 0
fi

docker pull $KIBANA_BASE_IMAGE:latest
docker_with_retry pull $KIBANA_BASE_IMAGE:latest

echo "--- Build images"
node scripts/build \
Expand All @@ -50,8 +51,8 @@ docker load < "target/kibana-serverless-$BASE_VERSION-docker-image-aarch64.tar.g
docker tag "$KIBANA_IMAGE" "$KIBANA_IMAGE-arm64"

echo "--- Push images"
docker image push "$KIBANA_IMAGE-arm64"
docker image push "$KIBANA_IMAGE-amd64"
docker_with_retry push "$KIBANA_IMAGE-arm64"
docker_with_retry push "$KIBANA_IMAGE-amd64"

echo "--- Create and push manifests"
docker manifest create \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

source .buildkite/scripts/common/util.sh

if [ "$KIBANA_MKI_QUALITY_GATE" == "1" ]; then
echo "Triggered by quality gate!"
triggered_by="Serverless Quality Gate."
Expand All @@ -17,11 +19,11 @@ else
KBN_IMAGE=${KIBANA_LATEST}
fi

docker pull ${KBN_IMAGE}
docker_with_retry pull ${KBN_IMAGE}
build_date=$(docker inspect ${KBN_IMAGE} | jq -r '.[0].Config.Labels."org.label-schema.build-date"')
vcs_ref=$(docker inspect ${KBN_IMAGE} | jq -r '.[0].Config.Labels."org.label-schema.vcs-ref"')
vcs_url=$(docker inspect ${KBN_IMAGE} | jq -r '.[0].Config.Labels."org.label-schema.vcs-url"')
version=$(docker inspect ${KBN_IMAGE} | jq -r '.[0].Config.Labels."org.label-schema.version"')
version=$(docker inspect ${KBN_IMAGE} | jq -r '.[0].Config.Labels."org.label-schema.version"')

markdown_text="""
#### $triggered_by
Expand All @@ -32,9 +34,9 @@ markdown_text="""
---
#### Kibana Container Metadata
- Build Date : $build_date
- Github Commit Hash : $vcs_ref
- Github Repo : $vcs_url
- Build Date : $build_date
- Github Commit Hash : $vcs_ref
- Github Repo : $vcs_url
- Version : $version
"""
echo "${markdown_text//[*\\_]/\\&}" | buildkite-agent annotate --style "info"
echo "${markdown_text//[*\\_]/\\&}" | buildkite-agent annotate --style "info"
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/artifacts/cloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ docker tag "$KIBANA_BASE_IMAGE" "$KIBANA_TEST_IMAGE"
if docker manifest inspect $KIBANA_TEST_IMAGE &> /dev/null; then
echo "Cloud image already exists, skipping docker push"
else
docker image push "$KIBANA_TEST_IMAGE"
docker_with_retry push "$KIBANA_TEST_IMAGE"
fi

echo "--- Create deployment"
Expand Down
6 changes: 4 additions & 2 deletions .buildkite/scripts/steps/artifacts/docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set -euo pipefail

source .buildkite/scripts/steps/artifacts/env.sh

source .buildkite/scripts/common/util.sh

GIT_ABBREV_COMMIT=${BUILDKITE_COMMIT:0:12}
if [[ "${BUILDKITE_PULL_REQUEST:-false}" == "false" ]]; then
KIBANA_IMAGE_TAG="git-$GIT_ABBREV_COMMIT"
Expand Down Expand Up @@ -50,8 +52,8 @@ if [[ "$SKIP_BUILD" == "false" ]]; then
docker tag "$KIBANA_IMAGE" "$KIBANA_IMAGE-arm64"

echo "--- Push images"
docker image push "$KIBANA_IMAGE-arm64"
docker image push "$KIBANA_IMAGE-amd64"
docker_with_retry push "$KIBANA_IMAGE-arm64"
docker_with_retry push "$KIBANA_IMAGE-amd64"

echo "--- Create and push manifests"
docker manifest create \
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/artifacts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ chmod -R a+r target/*
chmod -R a+w target

echo "--- Pull latest Release Manager CLI"
docker pull docker.elastic.co/infra/release-manager:latest
docker_with_retry pull docker.elastic.co/infra/release-manager:latest

echo "--- Publish artifacts"
if [[ "$BUILDKITE_BRANCH" == "$KIBANA_BASE_BRANCH" ]] || [[ "${DRY_RUN:-}" =~ ^(1|true)$ ]]; then
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/capture_oas_snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
source .buildkite/scripts/common/util.sh

echo --- Capture OAS snapshot
cmd="node scripts/capture_oas_snapshot --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules"
cmd="node scripts/capture_oas_snapshot --include-path /api/status --include-path /api/alerting/rule/ --include-path /api/alerting/rules --include-path /api/actions"
if is_pr && ! is_auto_commit_disabled; then
cmd="$cmd --update"
fi
Expand Down
3 changes: 2 additions & 1 deletion .buildkite/scripts/steps/demo_env/es_and_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euo pipefail

source "$(dirname "${0}")/config.sh"
source "$(dirname "${0}")/../../common/util.sh"

"$(dirname "${0}")/auth.sh"

Expand All @@ -16,7 +17,7 @@ DOCKER_EXPORT_URL=$(curl https://storage.googleapis.com/kibana-ci-es-snapshots-d
curl "$DOCKER_EXPORT_URL" > target/elasticsearch-docker.tar.gz
docker load < target/elasticsearch-docker.tar.gz
docker tag "docker.elastic.co/elasticsearch/elasticsearch:$DEPLOYMENT_VERSION-SNAPSHOT" "$ES_IMAGE"
docker push "$ES_IMAGE"
docker_with_retry push "$ES_IMAGE"

echo '--- Prepare yaml'

Expand Down
4 changes: 3 additions & 1 deletion .buildkite/scripts/steps/demo_env/kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -euo pipefail

.buildkite/scripts/bootstrap.sh

source .buildkite/scripts/common/util.sh

source "$(dirname "${0}")/config.sh"

export KIBANA_IMAGE="gcr.io/elastic-kibana-184716/demo/kibana:$DEPLOYMENT_NAME-$(git rev-parse HEAD)"
Expand All @@ -15,7 +17,7 @@ echo '--- Build Docker image with example plugins'
cd target/example_plugins
BUILT_IMAGE="docker.elastic.co/kibana/kibana:$DEPLOYMENT_VERSION-SNAPSHOT"
docker build --build-arg BASE_IMAGE="$BUILT_IMAGE" -t "$KIBANA_IMAGE" -f "$KIBANA_DIR/.buildkite/scripts/steps/demo_env/Dockerfile" .
docker push "$KIBANA_IMAGE"
docker_with_retry push "$KIBANA_IMAGE"
cd -

"$(dirname "${0}")/auth.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -euo pipefail

source .buildkite/scripts/common/util.sh

KIBANA_GITHUB_URL="https://github.com/elastic/kibana"
ES_SERVERLESS_GITHUB_URL="https://github.com/elastic/elasticsearch-serverless"

Expand All @@ -15,7 +17,7 @@ fi

# Pull the target image
if [[ $ES_SERVERLESS_IMAGE != *":git-"* ]]; then
docker pull "$ES_SERVERLESS_IMAGE"
docker_with_retry pull "$ES_SERVERLESS_IMAGE"
ES_SERVERLESS_VERSION=$(docker inspect --format='{{json .Config.Labels}}' "$ES_SERVERLESS_IMAGE" | jq -r '.["org.opencontainers.image.revision"]' | cut -c1-12)

IMAGE_WITHOUT_TAG=$(echo "$ES_SERVERLESS_IMAGE" | cut -d: -f1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ ARM_64_DIGEST=$(jq -r '.manifests[] | select(.platform.architecture == "arm64")
AMD_64_DIGEST=$(jq -r '.manifests[] | select(.platform.architecture == "amd64") | .digest' manifests.json)

echo docker pull --platform linux/arm64 "$SOURCE_IMAGE@$ARM_64_DIGEST"
docker pull --platform linux/arm64 "$SOURCE_IMAGE@$ARM_64_DIGEST"
docker_with_retry pull --platform linux/arm64 "$SOURCE_IMAGE@$ARM_64_DIGEST"
echo linux/arm64 image pulled, with digest: $ARM_64_DIGEST

echo docker pull --platform linux/amd64 "$SOURCE_IMAGE@$AMD_64_DIGEST"
docker pull --platform linux/amd64 "$SOURCE_IMAGE@$AMD_64_DIGEST"
docker_with_retry pull --platform linux/amd64 "$SOURCE_IMAGE@$AMD_64_DIGEST"
echo linux/amd64 image pulled, with digest: $AMD_64_DIGEST

docker tag "$SOURCE_IMAGE@$ARM_64_DIGEST" "$TARGET_IMAGE-arm64"
docker tag "$SOURCE_IMAGE@$AMD_64_DIGEST" "$TARGET_IMAGE-amd64"

docker push "$TARGET_IMAGE-arm64"
docker push "$TARGET_IMAGE-amd64"
docker_with_retry push "$TARGET_IMAGE-arm64"
docker_with_retry push "$TARGET_IMAGE-amd64"

docker manifest rm "$TARGET_IMAGE" || echo "Nothing to delete"

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/es_snapshots/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ set +e
echo $ES_CLOUD_ID $ES_CLOUD_VERSION $KIBANA_ES_CLOUD_VERSION $KIBANA_ES_CLOUD_IMAGE
docker tag "$ES_CLOUD_ID" "$KIBANA_ES_CLOUD_IMAGE"

docker image push "$KIBANA_ES_CLOUD_IMAGE"
docker_with_retry push "$KIBANA_ES_CLOUD_IMAGE"

export ELASTICSEARCH_CLOUD_IMAGE="$KIBANA_ES_CLOUD_IMAGE"
export ELASTICSEARCH_CLOUD_IMAGE_CHECKSUM="$(docker images "$KIBANA_ES_CLOUD_IMAGE" --format "{{.Digest}}")"
Expand Down
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1371,8 +1371,10 @@ module.exports = {
},
{
files: [
'test/{accessibility,*functional*,*api_integration*}/apps/**/*.{js,ts}',
'x-pack/test/{accessibility,*functional*,*api_integration*}/apps/**/*.{js,ts}',
'test/{accessibility,*functional*}/apps/**/*.{js,ts}',
'test/*api_integration*/**/*.{js,ts}',
'x-pack/test/{accessibility,*functional*}/apps/**/*.{js,ts}',
'x-pack/test/*api_integration*/**/*.{js,ts}',
'x-pack/test_serverless/{functional,api_integration}/test_suites/**/*.{js,ts}',
],
extends: ['plugin:mocha/recommended'],
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,13 @@ jobs:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml

# TODO: Possibly required to follow all call paths, however, when enabled, the step below runs out of memory.
# Possible workarounds: Apply for access to the GitHub beta where we can use beefier machines, or run it ourselves on Buildkite
# - name: yarn kbn bootstrap
# run: |
# mkdir ~/.npm-global
# npm config set prefix '~/.npm-global'
# export PATH=~/.npm-global/bin:$PATH
# yarn kbn bootstrap --no-validate --no-vscode
- name: setup node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: yarn kbn bootstrap
run: |
yarn kbn bootstrap --no-validate --no-vscode
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@883d8588e56d1753a8a58c1c86e88976f0c23449 # v3.26.3
Expand Down
2 changes: 1 addition & 1 deletion api_docs/actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/actions
title: "actions"
image: https://source.unsplash.com/400x175/?github
description: API docs for the actions plugin
date: 2024-08-29
date: 2024-09-04
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'actions']
---
import actionsObj from './actions.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/advanced_settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/advancedSettings
title: "advancedSettings"
image: https://source.unsplash.com/400x175/?github
description: API docs for the advancedSettings plugin
date: 2024-08-29
date: 2024-09-04
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'advancedSettings']
---
import advancedSettingsObj from './advanced_settings.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/ai_assistant_management_selection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiAssistantManagementSelection
title: "aiAssistantManagementSelection"
image: https://source.unsplash.com/400x175/?github
description: API docs for the aiAssistantManagementSelection plugin
date: 2024-08-29
date: 2024-09-04
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiAssistantManagementSelection']
---
import aiAssistantManagementSelectionObj from './ai_assistant_management_selection.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/aiops.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/aiops
title: "aiops"
image: https://source.unsplash.com/400x175/?github
description: API docs for the aiops plugin
date: 2024-08-29
date: 2024-09-04
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'aiops']
---
import aiopsObj from './aiops.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/alerting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ slug: /kibana-dev-docs/api/alerting
title: "alerting"
image: https://source.unsplash.com/400x175/?github
description: API docs for the alerting plugin
date: 2024-08-29
date: 2024-09-04
tags: ['contributor', 'dev', 'apidocs', 'kibana', 'alerting']
---
import alertingObj from './alerting.devdocs.json';
Expand Down
2 changes: 1 addition & 1 deletion api_docs/apm.devdocs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6149,7 +6149,7 @@
},
">; } & { start: number; end: number; }; }; }) => Promise<",
"ServiceEntities",
">; } & ",
" | undefined>; } & ",
"APMRouteCreateOptions",
"; \"POST /internal/apm/entities/services/detailed_statistics\": { endpoint: \"POST /internal/apm/entities/services/detailed_statistics\"; params?: ",
"TypeC",
Expand Down
Loading

0 comments on commit f409076

Please sign in to comment.