Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-telemetry-for-toasts-166459-2
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Sep 26, 2023
2 parents f9717ed + 01a7841 commit bf875b8
Show file tree
Hide file tree
Showing 1,924 changed files with 26,606 additions and 10,451 deletions.
58 changes: 58 additions & 0 deletions .buildkite/pipelines/es_serverless/verify_es_serverless_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# https://buildkite.com/elastic/kibana-elasticsearch-serverless-verify-and-promote/
agents:
queue: kibana-default

steps:
- label: "Annotate runtime parameters"
command: |
buildkite-agent annotate --context es-serverless-image --style info "ES Serverless image: $ES_SERVERLESS_IMAGE"
buildkite-agent annotate --context kibana-commit --style info "Kibana build hash: $BUILDKITE_BRANCH / $BUILDKITE_COMMIT"
- group: "(:kibana: x :elastic:) Trigger Kibana Serverless suite"
if: "build.env('SKIP_VERIFICATION') != '1' && build.env('SKIP_VERIFICATION') != 'true'"
steps:
- label: "Pre-Build"
command: .buildkite/scripts/lifecycle/pre_build.sh
key: pre-build
timeout_in_minutes: 10
agents:
queue: kibana-default

- label: "Build Kibana Distribution and Plugins"
command: .buildkite/scripts/steps/build_kibana.sh
agents:
queue: n2-16-spot
key: build
depends_on: pre-build
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3

- label: "Pick Test Group Run Order"
command: .buildkite/scripts/steps/test/pick_test_group_run_order.sh
agents:
queue: kibana-default
env:
FTR_CONFIGS_SCRIPT: 'TEST_ES_SERVERLESS_IMAGE=$ES_SERVERLESS_IMAGE .buildkite/scripts/steps/test/ftr_configs.sh'
FTR_CONFIG_PATTERNS: '**/test_serverless/**'
LIMIT_CONFIG_TYPE: 'functional'
retry:
automatic:
- exit_status: '*'
limit: 1

- wait: ~

- label: ":arrow_up::elastic::arrow_up: Promote docker image"
command: .buildkite/scripts/steps/es_serverless/promote_es_serverless_image.sh $ES_SERVERLESS_IMAGE

- wait: ~

- label: 'Post-Build'
command: .buildkite/scripts/lifecycle/post_build.sh
timeout_in_minutes: 10
agents:
queue: kibana-default
7 changes: 5 additions & 2 deletions .buildkite/pipelines/on_merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ steps:
- exit_status: '-1'
limit: 3

- command: .buildkite/scripts/steps/check_types.sh
label: 'Check Types'
- command: .buildkite/scripts/steps/check_types_commits.sh
label: 'Check Types Commit Diff'
# TODO: Enable in #166813 after fixing types
# - command: .buildkite/scripts/steps/check_types.sh
# label: 'Check Types'
agents:
queue: n2-16-spot
timeout_in_minutes: 60
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/pipelines/on_merge_unsupported_ftrs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ steps:
- command: .buildkite/scripts/steps/functional/defend_workflows.sh
label: 'Defend Workflows Cypress Tests'
agents:
queue: n2-4-spot
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 120
parallelism: 2
parallelism: 6
retry:
automatic:
- exit_status: '*'
Expand Down
19 changes: 10 additions & 9 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ steps:
- exit_status: '-1'
limit: 3

- command: .buildkite/scripts/steps/check_types.sh
label: 'Check Types'
agents:
queue: n2-16-spot
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3
# TODO: Enable in #166813 after fixing types
# - command: .buildkite/scripts/steps/check_types.sh
# label: 'Check Types'
# agents:
# queue: n2-16-spot
# timeout_in_minutes: 60
# retry:
# automatic:
# - exit_status: '-1'
# limit: 3
2 changes: 1 addition & 1 deletion .buildkite/pipelines/pull_request/defend_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
- command: .buildkite/scripts/steps/functional/defend_workflows_serverless.sh
label: 'Defend Workflows Cypress Tests on Serverless'
agents:
queue: n2-4-spot
queue: n2-4-virt
depends_on: build
timeout_in_minutes: 120
parallelism: 2
Expand Down
10 changes: 10 additions & 0 deletions .buildkite/pipelines/pull_request/type_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
steps:
- command: .buildkite/scripts/steps/check_types.sh
label: 'Check Types'
agents:
queue: n2-16-spot
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3
10 changes: 10 additions & 0 deletions .buildkite/pipelines/pull_request/type_check_selective.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
steps:
- command: .buildkite/scripts/steps/check_types_commits.sh
label: 'Check Types Commit Diff'
agents:
queue: n2-16-spot
timeout_in_minutes: 60
retry:
automatic:
- exit_status: '-1'
limit: 3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# These pipeline steps constitute the quality gate for your service within the production
# environment. Incorporate any necessary additional logic to validate the service's integrity.
# These pipeline steps constitute the quality gate for your service within the production environment.
# Incorporate any necessary additional logic to validate the service's integrity.
# A failure in this pipeline build will prevent further progression to the subsequent stage.

steps:
Expand Down
16 changes: 14 additions & 2 deletions .buildkite/pipelines/quality-gates/pipeline.tests-qa.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# These pipeline steps constitute the quality gate for your service within the QA environment.
# Incorporate any necessary additional logic to validate the service's integrity. A failure in
# this pipeline build will prevent further progression to the subsequent stage.
# Incorporate any necessary additional logic to validate the service's integrity.
# A failure in this pipeline build will prevent further progression to the subsequent stage.

steps:
- label: ":pipeline::kibana::seedling: Trigger SLO check"
trigger: "serverless-quality-gates" # https://buildkite.com/elastic/serverless-quality-gates
build:
message: "${BUILDKITE_MESSAGE} (triggered by pipeline.tests-qa.yaml)"
env:
TARGET_ENV: qa
CHECK_SLO: true
CHECK_SLO_TAG: kibana
CHECK_SLO_WAITING_PERIOD: 10m
CHECK_SLO_BURN_RATE_THRESHOLD: 0.1
soft_fail: true

- label: ":pipeline::kibana::seedling: Trigger Kibana Serverless Tests for ${ENVIRONMENT}"
trigger: appex-qa-serverless-kibana-ftr-tests # https://buildkite.com/elastic/appex-qa-serverless-kibana-ftr-tests
soft_fail: true # Remove this before release or when tests stabilize
Expand Down
14 changes: 12 additions & 2 deletions .buildkite/pipelines/quality-gates/pipeline.tests-staging.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
# These pipeline steps constitute the quality gate for your service within the staging environment.
# Incorporate any necessary additional logic to validate the service's integrity. A failure in
# this pipeline build will prevent further progression to the subsequent stage.
# Incorporate any necessary additional logic to validate the service's integrity.
# A failure in this pipeline build will prevent further progression to the subsequent stage.

steps:
- label: ":pipeline::kibana::seedling: Trigger SLO check"
trigger: "serverless-quality-gates" # https://buildkite.com/elastic/serverless-quality-gates
build:
message: "${BUILDKITE_MESSAGE} (triggered by pipeline.tests-staging.yaml)"
env:
TARGET_ENV: staging
CHECK_SLO: true
CHECK_SLO_TAG: kibana
soft_fail: true

- label: ":pipeline::rocket::seedling: Trigger control-plane e2e tests"
trigger: "ess-k8s-staging-e2e-tests" # https://buildkite.com/elastic/ess-k8s-staging-e2e-tests
build:
Expand Down
6 changes: 6 additions & 0 deletions .buildkite/scripts/pipelines/pull_request/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ const uploadPipeline = (pipelineContent: string | object) => {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/kbn_handlebars.yml'));
}

if (GITHUB_PR_LABELS.includes('ci:hard-typecheck')) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/type_check.yml'));
} else {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/type_check_selective.yml'));
}

if (
(await doAnyChangesMatch([
/^src\/plugins\/controls/,
Expand Down
5 changes: 3 additions & 2 deletions .buildkite/scripts/steps/build_api_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ set -euo pipefail

.buildkite/scripts/bootstrap.sh

echo "--- Run scripts/type_check to ensure that all build available"
node scripts/type_check
# TODO: Enable in #166813 after fixing types
# echo "--- Run scripts/type_check to ensure that all build available"
# node scripts/type_check

echo "--- Build API Docs"
node --max-old-space-size=12000 scripts/build_api_docs
Expand Down
114 changes: 114 additions & 0 deletions .buildkite/scripts/steps/check_types_commits.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/usr/bin/env bash

set -euo pipefail


if [[ "${CI-}" == "true" ]]; then
.buildkite/scripts/bootstrap.sh

sha1=$(git merge-base $GITHUB_PR_TARGET_BRANCH $GITHUB_PR_TRIGGERED_SHA)
sha2="${GITHUB_PR_TRIGGERED_SHA-}"
else
# Script take between 0 and 2 arguments representing two commit SHA's:
# If 0, it will diff HEAD and HEAD^
# If 1 (SHA1), it will diff SHA1 and SHA1^
# If 2 (SHA1, SHA2), it will diff SHA1 and SHA2
sha1="${1-HEAD}"
sha2="${2-$sha1^}"
fi

uniq_dirs=()
uniq_tsconfigs=()

echo "Detecting files changed between $sha1 and $sha2..."

files=($(git diff --name-only $sha1 $sha2))

add_dir () {
new_dir=$1

if [ ${#uniq_dirs[@]} -gt 0 ]; then
for dir in "${uniq_dirs[@]}"
do
if [[ "$new_dir" == "$dir" ]]; then
return
fi
done
fi

uniq_dirs+=($new_dir)
}

add_tsconfig () {
new_tsconfig=$1

if [ ${#uniq_tsconfigs[@]} -gt 0 ]; then
for tsconfig in "${uniq_tsconfigs[@]}"
do
if [[ "$new_tsconfig" == "$tsconfig" ]]; then
return
fi
done
fi

echo " $new_tsconfig"
uniq_tsconfigs+=($new_tsconfig)
}

contains_tsconfig () {
dir=$1
tsconfig="$dir/tsconfig.json"
if [ -f "$tsconfig" ]; then
true
else
false
fi
}

find_tsconfig () {
dir=$1

if [[ "$dir" == "." ]]; then
return
fi

if contains_tsconfig $dir; then
add_tsconfig "$dir/tsconfig.json"
else
find_tsconfig $(dirname -- "$dir")
fi
}

if [ ${#files[@]} -eq 0 ]; then
echo "No files found!"
exit
fi

for file in "${files[@]}"
do
dir=$(dirname -- "$file")

# Ignore buildkite dir because it traverses many kbn packages and emits incorrect results
if [[ "$dir" != .buildkite* ]]; then
add_dir $dir
fi
done

echo "Looking for related tsconfig.json files..."

for dir in "${uniq_dirs[@]}"
do
find_tsconfig $dir
done

if [ ${#uniq_tsconfigs[@]} -eq 0 ]; then
echo "No tsconfig.json files found for changes in $sha1 $sha2"
exit
fi

echo "Running scripts/type_check for each found tsconfig.json file..."

for tsconfig in "${uniq_tsconfigs[@]}"
do
node scripts/type_check --project $tsconfig
done
Loading

0 comments on commit bf875b8

Please sign in to comment.