Skip to content

Commit e5dbcd6

Browse files
author
CJ Cenizal
authored
Merge branch 'main' into bug/watcher-stuck-firing-state
2 parents 72e7bc6 + e7772b1 commit e5dbcd6

File tree

1,132 files changed

+22100
-9536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,132 files changed

+22100
-9536
lines changed

.buildkite/agents.json

Lines changed: 0 additions & 79 deletions
This file was deleted.

.buildkite/scripts/common/env.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,22 @@ export KIBANA_BASE_BRANCH="$KIBANA_PKG_BRANCH"
2626
KIBANA_PKG_VERSION="$(jq -r .version "$KIBANA_DIR/package.json")"
2727
export KIBANA_PKG_VERSION
2828

29-
export GECKODRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
30-
export CHROMEDRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
31-
export RE2_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache"
32-
export CYPRESS_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache/cypress"
29+
BUILDKITE_AGENT_GCP_REGION=""
30+
if [[ "$(curl -is metadata.google.internal || true)" ]]; then
31+
# projects/1003139005402/zones/us-central1-a -> us-central1-a -> us-central1
32+
BUILDKITE_AGENT_GCP_REGION=$(curl -sH Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/zone | rev | cut -d'/' -f1 | cut -c3- | rev)
33+
fi
34+
export BUILDKITE_AGENT_GCP_REGION
35+
36+
CI_PROXY_CACHE_SUFFIX=""
37+
if [[ "$BUILDKITE_AGENT_GCP_REGION" ]]; then
38+
CI_PROXY_CACHE_SUFFIX="/region/$BUILDKITE_AGENT_GCP_REGION"
39+
fi
40+
41+
export GECKODRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache$CI_PROXY_CACHE_SUFFIX"
42+
export CHROMEDRIVER_CDNURL="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache$CI_PROXY_CACHE_SUFFIX"
43+
export RE2_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache$CI_PROXY_CACHE_SUFFIX"
44+
export CYPRESS_DOWNLOAD_MIRROR="https://us-central1-elastic-kibana-184716.cloudfunctions.net/kibana-ci-proxy-cache$CI_PROXY_CACHE_SUFFIX/cypress"
3345

3446
export NODE_OPTIONS="--max-old-space-size=4096"
3547

.buildkite/scripts/common/setup_bazel.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@ BAZEL_CACHE_MODE=${BAZEL_CACHE_MODE:-gcs}
1616
if [[ "$BAZEL_CACHE_MODE" == "gcs" ]]; then
1717
echo "[bazel] enabling caching with GCS buckets"
1818

19-
BAZEL_REGION="us-central1"
20-
if [[ "$(curl -is metadata.google.internal || true)" ]]; then
21-
# projects/1003139005402/zones/us-central1-a -> us-central1-a -> us-central1
22-
BAZEL_REGION=$(curl -sH Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/zone | rev | cut -d'/' -f1 | cut -c3- | rev)
23-
fi
24-
19+
BAZEL_REGION="${BUILDKITE_AGENT_GCP_REGION:-us-central1}"
2520
BAZEL_BUCKET="kibana-ci-bazel_$BAZEL_REGION"
2621

2722
echo "[bazel] using GCS bucket: $BAZEL_BUCKET"

.buildkite/scripts/pipelines/pull_request/pipeline.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ const uploadPipeline = (pipelineContent: string | object) => {
122122
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/ux_plugin_e2e.yml'));
123123
}
124124

125-
if (GITHUB_PR_LABELS.includes('ci:deploy-cloud')) {
125+
if (
126+
GITHUB_PR_LABELS.includes('ci:deploy-cloud') ||
127+
GITHUB_PR_LABELS.includes('ci:cloud-deploy') ||
128+
GITHUB_PR_LABELS.includes('ci:cloud-redeploy')
129+
) {
126130
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/deploy_cloud.yml'));
127131
}
128132

.buildkite/scripts/steps/cloud/build_and_deploy.sh

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ source .buildkite/scripts/common/util.sh
99
export KBN_NP_PLUGINS_BUILT=true
1010

1111
VERSION="$(jq -r '.version' package.json)-SNAPSHOT"
12+
ECCTL_LOGS=$(mktemp --suffix ".json")
1213

1314
echo "--- Download Kibana Distribution"
1415

@@ -46,9 +47,19 @@ fi
4647

4748
docker logout docker.elastic.co
4849

50+
if is_pr_with_label "ci:cloud-redeploy"; then
51+
echo "--- Shutdown Previous Deployment"
52+
CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id')
53+
if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then
54+
echo "No deployment to remove"
55+
else
56+
echo "Shutting down previous deployment..."
57+
ecctl deployment shutdown "$CLOUD_DEPLOYMENT_ID" --force --track --output json > "$ECCTL_LOGS"
58+
fi
59+
fi
60+
4961
echo "--- Create Deployment"
5062
CLOUD_DEPLOYMENT_ID=$(ecctl deployment list --output json | jq -r '.deployments[] | select(.name == "'$CLOUD_DEPLOYMENT_NAME'") | .id')
51-
JSON_FILE=$(mktemp --suffix ".json")
5263
if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then
5364
jq '
5465
.resources.kibana[0].plan.kibana.docker_image = "'$KIBANA_CLOUD_IMAGE'" |
@@ -60,45 +71,49 @@ if [ -z "${CLOUD_DEPLOYMENT_ID}" ]; then
6071
.resources.integrations_server[0].plan.integrations_server.version = "'$VERSION'"
6172
' .buildkite/scripts/steps/cloud/deploy.json > /tmp/deploy.json
6273

63-
echo -n "Creating deployment..."
64-
ecctl deployment create --track --output json --file /tmp/deploy.json > "$JSON_FILE"
65-
echo "done"
74+
echo "Creating deployment..."
75+
ecctl deployment create --track --output json --file /tmp/deploy.json > "$ECCTL_LOGS"
6676

67-
CLOUD_DEPLOYMENT_USERNAME=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.username' "$JSON_FILE")
68-
CLOUD_DEPLOYMENT_PASSWORD=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.password' "$JSON_FILE")
69-
CLOUD_DEPLOYMENT_ID=$(jq -r --slurp '.[0].id' "$JSON_FILE")
70-
CLOUD_DEPLOYMENT_STATUS_MESSAGES=$(jq --slurp '[.[]|select(.resources == null)]' "$JSON_FILE")
77+
CLOUD_DEPLOYMENT_USERNAME=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.username' "$ECCTL_LOGS")
78+
CLOUD_DEPLOYMENT_PASSWORD=$(jq --slurp '.[]|select(.resources).resources[] | select(.credentials).credentials.password' "$ECCTL_LOGS")
79+
CLOUD_DEPLOYMENT_ID=$(jq -r --slurp '.[0].id' "$ECCTL_LOGS")
80+
CLOUD_DEPLOYMENT_STATUS_MESSAGES=$(jq --slurp '[.[]|select(.resources == null)]' "$ECCTL_LOGS")
7181

72-
echo -n "Writing to vault..."
82+
echo "Writing to vault..."
7383
VAULT_ROLE_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-role-id)"
7484
VAULT_SECRET_ID="$(retry 5 15 gcloud secrets versions access latest --secret=kibana-buildkite-vault-secret-id)"
7585
VAULT_TOKEN=$(retry 5 30 vault write -field=token auth/approle/login role_id="$VAULT_ROLE_ID" secret_id="$VAULT_SECRET_ID")
7686
retry 5 30 vault login -no-print "$VAULT_TOKEN"
7787
retry 5 5 vault write "secret/kibana-issues/dev/cloud-deploy/$CLOUD_DEPLOYMENT_NAME" username="$CLOUD_DEPLOYMENT_USERNAME" password="$CLOUD_DEPLOYMENT_PASSWORD"
7888

79-
echo -n "Enabling Stack Monitoring..."
89+
echo "Enabling Stack Monitoring..."
8090
jq '
8191
.settings.observability.metrics.destination.deployment_id = "'$CLOUD_DEPLOYMENT_ID'" |
8292
.settings.observability.logging.destination.deployment_id = "'$CLOUD_DEPLOYMENT_ID'"
8393
' .buildkite/scripts/steps/cloud/stack_monitoring.json > /tmp/stack_monitoring.json
84-
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/stack_monitoring.json > "$JSON_FILE"
85-
echo "done"
8694

87-
echo -n "Enabling verbose logging..."
95+
# After a deployment is created, a new Kibana plan is automatically added to update settings
96+
# and restart Kibana. Polling for a plan state isn't especially reliable because it flips
97+
# between empty and queued, and then empty again depending on how quickly setup is run in cloud.
98+
# We want to enable monitoring after the automatic plan has run, if not we get an error:
99+
# * deployments.resource_plan_state_error: Kibana resource [main-kibana] has a plan still pending, cancel that or wait for it to complete (settings.observability.plan)
100+
# This adds a sleep and retry to see if we can make this step more reliable
101+
sleep 120
102+
retry 5 60 ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/stack_monitoring.json > "$ECCTL_LOGS"
103+
104+
echo "Enabling verbose logging..."
88105
ecctl deployment show "$CLOUD_DEPLOYMENT_ID" --generate-update-payload | jq '
89106
.resources.kibana[0].plan.kibana.user_settings_yaml = "logging.root.level: all"
90107
' > /tmp/verbose_logging.json
91-
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/verbose_logging.json > "$JSON_FILE"
92-
echo "done"
108+
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/verbose_logging.json > "$ECCTL_LOGS"
93109
else
94-
ecctl deployment show "$CLOUD_DEPLOYMENT_ID" --generate-update-payload | jq '
95-
.resources.kibana[0].plan.kibana.docker_image = "'$KIBANA_CLOUD_IMAGE'" |
96-
(.. | select(.version? != null).version) = "'$VERSION'"
97-
' > /tmp/deploy.json
98-
99-
echo -n "Updating deployment..."
100-
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/deploy.json > "$JSON_FILE"
101-
echo "done"
110+
ecctl deployment show "$CLOUD_DEPLOYMENT_ID" --generate-update-payload | jq '
111+
.resources.kibana[0].plan.kibana.docker_image = "'$KIBANA_CLOUD_IMAGE'" |
112+
(.. | select(.version? != null).version) = "'$VERSION'"
113+
' > /tmp/deploy.json
114+
115+
echo "Updating deployment..."
116+
ecctl deployment update "$CLOUD_DEPLOYMENT_ID" --track --output json --file /tmp/deploy.json > "$ECCTL_LOGS"
102117
fi
103118

104119
CLOUD_DEPLOYMENT_KIBANA_URL=$(ecctl deployment show "$CLOUD_DEPLOYMENT_ID" | jq -r '.resources.kibana[0].info.metadata.aliased_url')

.buildkite/scripts/steps/cloud/purge_deployments.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ for (const deployment of prDeployments) {
3131
if (pullRequest.state !== 'OPEN') {
3232
console.log(`Pull Request #${prNumber} is no longer open, will delete associated deployment`);
3333
deploymentsToPurge.push(deployment);
34-
} else if (!pullRequest.labels.filter((label: any) => label.name === 'ci:deploy-cloud')) {
34+
} else if (
35+
!pullRequest.labels.filter((label: any) =>
36+
/^ci:(deploy-cloud|cloud-deploy|cloud-redeploy)$/.test(label.name)
37+
)
38+
) {
3539
console.log(
36-
`Pull Request #${prNumber} no longer has the ci:deploy-cloud label, will delete associated deployment`
40+
`Pull Request #${prNumber} no longer has the a cloud deployment label, will delete associated deployment`
3741
);
3842
deploymentsToPurge.push(deployment);
3943
} else if (lastCommitTimestamp < NOW - 60 * 60 * 24 * 7) {

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ const DEV_PATTERNS = [
178178
'src/dev/**/*',
179179
'x-pack/{dev-tools,tasks,scripts,test,build_chromium}/**/*',
180180
'x-pack/plugins/*/server/scripts/**/*',
181+
'x-pack/plugins/fleet/cypress',
181182
];
182183

183184
/** Restricted imports with suggested alternatives */
@@ -1341,7 +1342,7 @@ module.exports = {
13411342
* Discover overrides
13421343
*/
13431344
{
1344-
files: ['src/plugins/discover/**/*.{ts,tsx}'],
1345+
files: ['src/plugins/discover/**/*.{ts,tsx}', 'src/plugins/saved_search/**/*.{ts,tsx}'],
13451346
rules: {
13461347
'@typescript-eslint/no-explicit-any': 'error',
13471348
'@typescript-eslint/ban-ts-comment': [

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
# Data Discovery
1212
/src/plugins/discover/ @elastic/kibana-data-discovery
13+
/src/plugins/saved_search/ @elastic/kibana-data-discovery
1314
/x-pack/plugins/discover_enhanced/ @elastic/kibana-data-discovery
1415
/test/functional/apps/discover/ @elastic/kibana-data-discovery
1516
/x-pack/plugins/graph/ @elastic/kibana-data-discovery

.i18nrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"dataViews": "src/plugins/data_views",
1919
"devTools": "src/plugins/dev_tools",
2020
"discover": "src/plugins/discover",
21+
"savedSearch": "src/plugins/saved_search",
2122
"embeddableApi": "src/plugins/embeddable",
2223
"embeddableExamples": "examples/embeddable_examples",
2324
"esQuery": "packages/kbn-es-query/src",

api_docs/actions.devdocs.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,7 @@
16221622
"label": "ActionParamsType",
16231623
"description": [],
16241624
"signature": [
1625-
"{ readonly group?: string | undefined; readonly source?: string | undefined; readonly component?: string | undefined; readonly summary?: string | undefined; readonly timestamp?: string | undefined; readonly eventAction?: \"resolve\" | \"trigger\" | \"acknowledge\" | undefined; readonly dedupKey?: string | undefined; readonly severity?: \"error\" | \"warning\" | \"info\" | \"critical\" | undefined; readonly class?: string | undefined; }"
1625+
"{ readonly group?: string | undefined; readonly source?: string | undefined; readonly summary?: string | undefined; readonly component?: string | undefined; readonly timestamp?: string | undefined; readonly eventAction?: \"resolve\" | \"trigger\" | \"acknowledge\" | undefined; readonly dedupKey?: string | undefined; readonly severity?: \"error\" | \"warning\" | \"info\" | \"critical\" | undefined; readonly class?: string | undefined; }"
16261626
],
16271627
"path": "x-pack/plugins/actions/server/builtin_action_types/pagerduty.ts",
16281628
"deprecated": false,
@@ -1814,7 +1814,9 @@
18141814
"ActionsConfigurationUtilities",
18151815
") => Promise<{ accessToken: string | null; }>; enqueueExecution: (options: ",
18161816
"ExecuteOptions",
1817-
") => Promise<void>; ephemeralEnqueuedExecution: (options: ",
1817+
") => Promise<void>; bulkEnqueueExecution: (options: ",
1818+
"ExecuteOptions",
1819+
"[]) => Promise<void>; ephemeralEnqueuedExecution: (options: ",
18181820
"ExecuteOptions",
18191821
") => Promise<",
18201822
{

0 commit comments

Comments
 (0)