[Event Log] Adding event log schema check to CI checks (#142104)

* Adding event log check to CI check.

* Adding event log check to CI check.

* Can I check out ECS

* Checking out specific ECS branch

* Checking out specific ECS branch

* Custom error message

* Reverting event log mapping test changes

* Pinning to 1.8

* Update .buildkite/scripts/steps/checks/event_log.sh

Co-authored-by: Jonathan Budzenski <jon@budzenski.me>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jonathan Budzenski <jon@budzenski.me>
This commit is contained in:
Ying Mao 2022-09-29 07:53:50 -04:00 committed by GitHub
parent 57a3162402
commit 16ca2d2895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 1 deletions

View file

@ -39,6 +39,7 @@ check_for_changed_files() {
C_RESET='\033[0m' # Reset color
SHOULD_AUTO_COMMIT_CHANGES="${2:-}"
CUSTOM_FIX_MESSAGE="${3:-}"
GIT_CHANGES="$(git ls-files --modified -- . ':!:.bazelrc')"
if [ "$GIT_CHANGES" ]; then
@ -75,7 +76,11 @@ check_for_changed_files() {
else
echo -e "\n${RED}ERROR: '$1' caused changes to the following files:${C_RESET}\n"
echo -e "$GIT_CHANGES\n"
echo -e "\n${YELLOW}TO FIX: Run '$1' locally, commit the changes and push to your branch${C_RESET}\n"
if [ "$CUSTOM_FIX_MESSAGE" ]; then
echo "$CUSTOM_FIX_MESSAGE"
else
echo -e "\n${YELLOW}TO FIX: Run '$1' locally, commit the changes and push to your branch${C_RESET}\n"
fi
exit 1
fi
fi

View file

@ -8,6 +8,7 @@ export DISABLE_BOOTSTRAP_VALIDATION=false
.buildkite/scripts/steps/checks/precommit_hook.sh
.buildkite/scripts/steps/checks/ftr_configs.sh
.buildkite/scripts/steps/checks/bazel_packages.sh
.buildkite/scripts/steps/checks/event_log.sh
.buildkite/scripts/steps/checks/telemetry.sh
.buildkite/scripts/steps/checks/ts_projects.sh
.buildkite/scripts/steps/checks/jest_configs.sh

View file

@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/common/util.sh
echo --- Check Event Log Schema
# event log schema is pinned to a specific version of ECS
ECS_STABLE_VERSION=1.8
git clone --depth 1 -b $ECS_STABLE_VERSION https://github.com/elastic/ecs.git ../ecs
node x-pack/plugins/event_log/scripts/create_schemas.js
check_for_changed_files 'node x-pack/plugins/event_log/scripts/create_schemas.js' false 'Follow the directions in x-pack/plugins/event_log/generated/README.md to make schema changes for the event log.'