mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[ES|QL] add function definition sync to CI (#184225)
## Summary Runs the script added in https://github.com/elastic/kibana/pull/179584 on the weekly schedule. Successful run: https://buildkite.com/elastic/kibana-es-ql-grammar-sync/builds/21#018fab3b-d051-4852-a03e-889cf156fb70/838 --------- Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
This commit is contained in:
parent
4f2f30f52d
commit
cf1ff97c12
4 changed files with 87 additions and 3 deletions
|
@ -1,6 +1,15 @@
|
|||
steps:
|
||||
- command: .buildkite/scripts/steps/esql_grammar_sync.sh
|
||||
label: ES|QL Grammar Sync
|
||||
label: Grammar Sync
|
||||
timeout_in_minutes: 10
|
||||
agents:
|
||||
image: family/kibana-ubuntu-2004
|
||||
imageProject: elastic-images-prod
|
||||
provider: gcp
|
||||
machineType: n2-standard-2
|
||||
preemptible: true
|
||||
- command: .buildkite/scripts/steps/esql_generate_function_definitions.sh
|
||||
label: Generate Function Definitions
|
||||
timeout_in_minutes: 10
|
||||
agents:
|
||||
image: family/kibana-ubuntu-2004
|
||||
|
|
76
.buildkite/scripts/steps/esql_generate_function_definitions.sh
Executable file
76
.buildkite/scripts/steps/esql_generate_function_definitions.sh
Executable file
|
@ -0,0 +1,76 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
report_main_step () {
|
||||
echo "--- $1"
|
||||
}
|
||||
|
||||
main () {
|
||||
cd "$PARENT_DIR"
|
||||
|
||||
report_main_step "Cloning Elasticsearch repository"
|
||||
|
||||
rm -rf elasticsearch
|
||||
git clone https://github.com/elastic/elasticsearch --depth 1
|
||||
|
||||
report_main_step "Bootstrapping Kibana"
|
||||
|
||||
cd "$KIBANA_DIR"
|
||||
|
||||
.buildkite/scripts/bootstrap.sh
|
||||
|
||||
cd "$KIBANA_DIR/packages/kbn-esql-validation-autocomplete"
|
||||
|
||||
report_main_step "Generate function definitions"
|
||||
|
||||
yarn make:defs $PARENT_DIR/elasticsearch
|
||||
|
||||
report_main_step "Generate function validation tests"
|
||||
|
||||
yarn make:tests
|
||||
|
||||
# Check for differences
|
||||
set +e
|
||||
git diff --exit-code --quiet .
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "No differences found. Our work is done here."
|
||||
exit
|
||||
fi
|
||||
set -e
|
||||
|
||||
report_main_step "Differences found. Checking for an existing pull request."
|
||||
|
||||
KIBANA_MACHINE_USERNAME="kibanamachine"
|
||||
git config --global user.name "$KIBANA_MACHINE_USERNAME"
|
||||
git config --global user.email '42973632+kibanamachine@users.noreply.github.com'
|
||||
|
||||
PR_TITLE='[ES|QL] Update function definitions'
|
||||
PR_BODY='This PR updates the function definitions based on the latest metadata from Elasticsearch.'
|
||||
|
||||
# Check if a PR already exists
|
||||
pr_search_result=$(gh pr list --search "$PR_TITLE" --state open --author "$KIBANA_MACHINE_USERNAME" --limit 1 --json title -q ".[].title")
|
||||
|
||||
if [ "$pr_search_result" == "$PR_TITLE" ]; then
|
||||
echo "PR already exists. Exiting."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "No existing PR found. Committing changes."
|
||||
|
||||
# Make a commit
|
||||
BRANCH_NAME="esql_generate_function_definitions_$(date +%s)"
|
||||
|
||||
git checkout -b "$BRANCH_NAME"
|
||||
|
||||
git add ./**/*
|
||||
git commit -m "Update function definitions"
|
||||
|
||||
report_main_step "Changes committed. Creating pull request."
|
||||
|
||||
git push origin "$BRANCH_NAME"
|
||||
|
||||
# Create a PR
|
||||
gh pr create --title "$PR_TITLE" --body "$PR_BODY" --base main --head "${BRANCH_NAME}" --label 'release_note:skip' --label 'Team:ESQL'
|
||||
}
|
||||
|
||||
main
|
1
.github/CODEOWNERS
vendored
1
.github/CODEOWNERS
vendored
|
@ -1219,6 +1219,7 @@ x-pack/test/observability_ai_assistant_functional @elastic/obs-ai-assistant
|
|||
/WORKSPACE.bazel @elastic/kibana-operations
|
||||
/.buildkite/ @elastic/kibana-operations
|
||||
/.buildkite/scripts/steps/esql_grammar_sync.sh @elastic/kibana-esql
|
||||
/.buildkite/scripts/steps/esql_generate_function_definitions.sh @elastic/kibana-esql
|
||||
/.buildkite/pipelines/esql_grammar_sync.yml @elastic/kibana-esql
|
||||
/kbn_pm/ @elastic/kibana-operations
|
||||
/x-pack/dev-tools @elastic/kibana-operations
|
||||
|
|
|
@ -354,7 +354,6 @@ import type { FunctionDefinition } from './types';
|
|||
const pathToElasticsearch = process.argv[2];
|
||||
|
||||
const ESFunctionDefinitionsDirectory = join(
|
||||
__dirname,
|
||||
pathToElasticsearch,
|
||||
'docs/reference/esql/functions/kibana/definition'
|
||||
);
|
||||
|
@ -365,7 +364,6 @@ import type { FunctionDefinition } from './types';
|
|||
);
|
||||
|
||||
const evalFunctionDefinitions: FunctionDefinition[] = [];
|
||||
// const aggFunctionDefinitions = [];
|
||||
for (const ESDefinition of ESFunctionDefinitions) {
|
||||
if (aliases.has(ESDefinition.name) || excludedFunctions.has(ESDefinition.name)) {
|
||||
continue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue