Skip to content

Commit 978db99

Browse files
Merge branch 'main' into cloud_logs_fix
2 parents b975476 + 3f6df1a commit 978db99

186 files changed

Lines changed: 4758 additions & 1544 deletions

File tree

Some content is hidden

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

.buildkite/pipelines/on_merge.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,16 @@ steps:
107107
- exit_status: '-1'
108108
limit: 3
109109

110+
- command: .buildkite/scripts/steps/bazel_cache/bootstrap_linux.sh
111+
label: 'Populate local dev bazel cache (Linux)'
112+
agents:
113+
queue: n2-4-spot
114+
timeout_in_minutes: 15
115+
retry:
116+
automatic:
117+
- exit_status: '-1'
118+
limit: 3
119+
110120
- wait: ~
111121
continue_on_failure: true
112122

.buildkite/scripts/common/setup_bazel.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ cat <<EOF >> $KIBANA_DIR/.bazelrc
3232
EOF
3333
fi
3434

35+
if [[ "$BAZEL_CACHE_MODE" == "populate-local-gcs" ]]; then
36+
echo "[bazel] enabling caching with GCS buckets for local dev"
37+
38+
cat <<EOF >> $KIBANA_DIR/.bazelrc
39+
build --remote_cache=https://storage.googleapis.com/kibana-local-bazel-remote-cache
40+
build --google_credentials=$BAZEL_LOCAL_DEV_CACHE_CREDENTIALS_FILE
41+
EOF
42+
fi
43+
3544
if [[ "$BAZEL_CACHE_MODE" == "buildbuddy" ]]; then
3645
echo "[bazel] enabling caching with Buildbuddy"
3746
cat <<EOF >> $KIBANA_DIR/.bazelrc
@@ -43,7 +52,7 @@ cat <<EOF >> $KIBANA_DIR/.bazelrc
4352
EOF
4453
fi
4554

46-
if [[ "$BAZEL_CACHE_MODE" != @(gcs|buildbuddy|none|) ]]; then
47-
echo "invalid value for BAZEL_CACHE_MODE received ($BAZEL_CACHE_MODE), expected one of [gcs,buildbuddy,none]"
55+
if [[ "$BAZEL_CACHE_MODE" != @(gcs|populate-local-gcs|buildbuddy|none|) ]]; then
56+
echo "invalid value for BAZEL_CACHE_MODE received ($BAZEL_CACHE_MODE), expected one of [gcs,populate-local-gcs|buildbuddy,none]"
4857
exit 1
4958
fi

.buildkite/scripts/lifecycle/pre_command.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ export SYNTHETICS_REMOTE_KIBANA_URL
132132
KIBANA_BUILDBUDDY_CI_API_KEY=$(retry 5 5 vault read -field=value secret/kibana-issues/dev/kibana-buildbuddy-ci-api-key)
133133
export KIBANA_BUILDBUDDY_CI_API_KEY
134134

135+
BAZEL_LOCAL_DEV_CACHE_CREDENTIALS_FILE="$HOME/.kibana-ci-bazel-remote-cache-local-dev.json"
136+
export BAZEL_LOCAL_DEV_CACHE_CREDENTIALS_FILE
137+
retry 5 5 vault read -field=service_account_json secret/kibana-issues/dev/kibana-ci-bazel-remote-cache-local-dev > "$BAZEL_LOCAL_DEV_CACHE_CREDENTIALS_FILE"
138+
135139
# By default, all steps should set up these things to get a full environment before running
136140
# It can be skipped for pipeline upload steps though, to make job start time a little faster
137141
if [[ "${SKIP_CI_SETUP:-}" != "true" ]]; then
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
source .buildkite/scripts/common/util.sh
6+
7+
export BAZEL_CACHE_MODE=populate-local-gcs
8+
export DISABLE_BOOTSTRAP_VALIDATION=true
9+
10+
# Clear out bazel cache between runs to make sure that any artifacts that don't exist in the cache are uploaded
11+
rm -rf ~/.bazel-cache
12+
13+
.buildkite/scripts/bootstrap.sh

.buildkite/scripts/steps/bazel_cache/bootstrap_mac.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,19 @@
22

33
set -euo pipefail
44

5-
export BAZEL_CACHE_MODE=buildbuddy
5+
source .buildkite/scripts/common/util.sh
6+
7+
export BAZEL_CACHE_MODE=populate-local-gcs
68
export DISABLE_BOOTSTRAP_VALIDATION=true
79

10+
# Clear out bazel cache between runs to make sure that any artifacts that don't exist in the cache are uploaded
11+
rm -rf ~/.bazel-cache
12+
813
# Since our Mac agents are currently static,
914
# use a temporary HOME directory that gets cleaned out between builds
1015
TMP_HOME="$WORKSPACE/tmp_home"
1116
rm -rf "$TMP_HOME"
17+
mkdir -p "$TMP_HOME"
1218
export HOME="$TMP_HOME"
1319

1420
.buildkite/scripts/bootstrap.sh

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@
499499
/x-pack/plugins/security_solution/public/common/components/health_truncate_text @elastic/security-detections-response-rules
500500
/x-pack/plugins/security_solution/public/common/components/links_to_docs @elastic/security-detections-response-rules
501501
/x-pack/plugins/security_solution/public/common/components/callouts @elastic/security-detections-response-rules
502+
/x-pack/plugins/security_solution/public/common/components/ml_popover @elastic/security-detections-response-rules
502503
/x-pack/plugins/security_solution/public/detections/components/callouts @elastic/security-detections-response-rules
503504
/x-pack/plugins/security_solution/public/detections/mitre @elastic/security-detections-response-rules
504505
/x-pack/plugins/security_solution/public/detections/pages/detection_engine/rules @elastic/security-detections-response-rules

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"yarn": "^1.21.1"
7474
},
7575
"resolutions": {
76-
"**/@babel/runtime": "^7.17.8",
76+
"**/@babel/runtime": "^7.17.9",
7777
"**/@types/node": "16.11.7",
7878
"**/chokidar": "^3.4.3",
7979
"**/deepmerge": "^4.2.2",
@@ -97,7 +97,7 @@
9797
"puppeteer/node-fetch": "^2.6.7"
9898
},
9999
"dependencies": {
100-
"@babel/runtime": "^7.17.8",
100+
"@babel/runtime": "^7.17.9",
101101
"@dnd-kit/core": "^3.1.1",
102102
"@dnd-kit/sortable": "^4.0.0",
103103
"@dnd-kit/utilities": "^2.0.0",
@@ -446,12 +446,12 @@
446446
"devDependencies": {
447447
"@apidevtools/swagger-parser": "^10.0.3",
448448
"@babel/cli": "^7.17.6",
449-
"@babel/core": "^7.17.8",
449+
"@babel/core": "^7.17.9",
450450
"@babel/eslint-parser": "^7.17.0",
451451
"@babel/eslint-plugin": "^7.17.7",
452-
"@babel/generator": "^7.17.7",
452+
"@babel/generator": "^7.17.9",
453453
"@babel/helper-plugin-utils": "^7.16.7",
454-
"@babel/parser": "^7.17.8",
454+
"@babel/parser": "^7.17.9",
455455
"@babel/plugin-proposal-class-properties": "^7.16.7",
456456
"@babel/plugin-proposal-export-namespace-from": "^7.16.7",
457457
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
@@ -463,7 +463,7 @@
463463
"@babel/preset-react": "^7.16.7",
464464
"@babel/preset-typescript": "^7.16.7",
465465
"@babel/register": "^7.17.7",
466-
"@babel/traverse": "^7.17.3",
466+
"@babel/traverse": "^7.17.9",
467467
"@babel/types": "^7.17.0",
468468
"@bazel/ibazel": "^0.16.2",
469469
"@bazel/typescript": "4.6.2",
@@ -796,7 +796,7 @@
796796
"babel-plugin-add-module-exports": "^1.0.4",
797797
"babel-plugin-istanbul": "^6.1.1",
798798
"babel-plugin-require-context-hook": "^1.0.0",
799-
"babel-plugin-styled-components": "^2.0.6",
799+
"babel-plugin-styled-components": "^2.0.7",
800800
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
801801
"backport": "^7.3.1",
802802
"callsites": "^3.1.0",

packages/analytics/client/src/schema/types.test.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,66 @@ describe('schema types', () => {
182182
});
183183
});
184184

185+
describe('Date value', () => {
186+
test('it should allow the correct type and enforce the _meta.description', () => {
187+
let valueType: SchemaValue<Date> = {
188+
type: 'date',
189+
_meta: {
190+
description: 'Some description',
191+
},
192+
};
193+
194+
valueType = {
195+
type: 'keyword',
196+
_meta: {
197+
description: 'Some description',
198+
optional: false,
199+
},
200+
};
201+
202+
valueType = {
203+
// @ts-expect-error because the type does not match
204+
type: 'long',
205+
_meta: {
206+
description: 'Some description',
207+
optional: false,
208+
},
209+
};
210+
211+
valueType = {
212+
type: 'keyword',
213+
_meta: {
214+
description: 'Some description',
215+
// @ts-expect-error optional can't be true when the types don't set the value as optional
216+
optional: true,
217+
},
218+
};
219+
220+
// @ts-expect-error because it's missing the _meta.description
221+
valueType = { type: 'date' };
222+
expect(valueType).not.toBeUndefined(); // <-- Only to stop the var-not-used complain
223+
});
224+
test('it should enforce `_meta.optional: true`', () => {
225+
let valueType: SchemaValue<Date | undefined> = {
226+
type: 'date',
227+
_meta: {
228+
description: 'Some description',
229+
optional: true,
230+
},
231+
};
232+
233+
valueType = {
234+
type: 'date',
235+
_meta: {
236+
description: 'Some description',
237+
// @ts-expect-error because optional can't be false when the value can be undefined
238+
optional: false,
239+
},
240+
};
241+
expect(valueType).not.toBeUndefined(); // <-- Only to stop the var-not-used complain
242+
});
243+
});
244+
185245
describe('Object value', () => {
186246
test('it should allow "pass_through" and enforce the _meta.description', () => {
187247
let valueType: SchemaValue<{ a_value: string }> = {

packages/analytics/client/src/schema/types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type AllowedSchemaTypes =
3131
/**
3232
* Helper to ensure the declared types match the schema types
3333
*/
34-
export type PossibleSchemaTypes<Value> = Value extends string
34+
export type PossibleSchemaTypes<Value> = Value extends string | Date
3535
? AllowedSchemaStringTypes
3636
: Value extends number
3737
? AllowedSchemaNumberTypes
@@ -66,6 +66,8 @@ export type SchemaValue<Value> =
6666
: // Otherwise, try to infer the type and enforce the schema
6767
NonNullable<Value> extends Array<infer U> | ReadonlyArray<infer U>
6868
? SchemaArray<U, Value>
69+
: NonNullable<Value> extends Date
70+
? SchemaChildValue<Value>
6971
: NonNullable<Value> extends object
7072
? SchemaObject<Value>
7173
: SchemaChildValue<Value>);

packages/elastic-eslint-config-kibana/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,6 @@ module.exports = {
196196
'@kbn/eslint/no_this_in_property_initializers': 'error',
197197
'@kbn/imports/no_unresolvable_imports': 'error',
198198
'@kbn/imports/uniform_imports': 'error',
199+
'@kbn/imports/no_unused_imports': 'error',
199200
},
200201
};

0 commit comments

Comments
 (0)