-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-embed-mode-screenshots_2024-03-21
- Loading branch information
Showing
1,345 changed files
with
24,635 additions
and
10,777 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
.buildkite/pipeline-resource-definitions/kibana-serverless-release.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# yaml-language-server: $schema=https://gist.githubusercontent.com/elasticmachine/988b80dae436cafea07d9a4a460a011d/raw/rre.schema.json | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Resource | ||
metadata: | ||
name: buildkite-pipeline-serverless-release | ||
description: Initiate kibana serverless releases | ||
links: | ||
- title: Pipeline | ||
url: https://buildkite.com/elastic/kibana-serverless-release | ||
spec: | ||
type: buildkite-pipeline | ||
owner: 'group:kibana-operations' | ||
system: buildkite | ||
implementation: | ||
apiVersion: buildkite.elastic.dev/v1 | ||
kind: Pipeline | ||
metadata: | ||
name: kibana / serverless / release | ||
description: Initiate kibana serverless releases | ||
spec: | ||
env: | ||
SLACK_NOTIFICATIONS_CHANNEL: '#kibana-operations-alerts' | ||
ELASTIC_SLACK_NOTIFICATIONS_ENABLED: 'false' | ||
default_branch: main | ||
allow_rebuilds: false | ||
skip_intermediate_builds: false | ||
repository: elastic/kibana | ||
pipeline_file: .buildkite/pipelines/serverless_deployment/run_serverless_release_assistant.yml | ||
provider_settings: | ||
build_branches: false | ||
build_pull_requests: false | ||
publish_commit_status: false | ||
trigger_mode: none | ||
build_tags: false | ||
prefix_pull_request_fork_branch_names: false | ||
skip_pull_request_builds_for_existing_commits: false | ||
teams: | ||
kibana-release-operators: | ||
access_level: MANAGE_BUILD_AND_READ | ||
everyone: | ||
access_level: READ_ONLY | ||
schedules: | ||
Weekly automated promotion to QA: | ||
cronline: 0 6 * * 1 | ||
message: Weekly automated promotion to QA | ||
env: | ||
AUTO_SELECT_COMMIT: 'true' | ||
branch: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
steps: | ||
- command: .buildkite/scripts/steps/esql_grammar_sync.sh | ||
label: ES|QL Grammar Sync | ||
timeout_in_minutes: 10 | ||
agents: | ||
queue: n2-2-spot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...less_deployment/create_deployment_tag.yml → ...ment/run_serverless_release_assistant.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
synchronize_lexer_grammar () { | ||
license_header="$1" | ||
source_file="$PARENT_DIR/elasticsearch/x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4" | ||
destination_file="./packages/kbn-monaco/src/esql/antlr/esql_lexer.g4" | ||
|
||
# Copy the file | ||
cp "$source_file" "$destination_file" | ||
|
||
# Insert the license header | ||
temp_file=$(mktemp) | ||
printf "%s\n\n// DO NOT MODIFY THIS FILE BY HAND. IT IS MANAGED BY A CI JOB.\n\n%s" "$license_header" "$(cat $destination_file)" > "$temp_file" | ||
mv "$temp_file" "$destination_file" | ||
|
||
# Replace the line containing "lexer grammar" with "lexer grammar esql_lexer;" | ||
sed -i -e 's/lexer grammar.*$/lexer grammar esql_lexer;/' "$destination_file" | ||
|
||
# Insert "options { caseInsensitive = true; }" one line below | ||
sed -i -e '/lexer grammar esql_lexer;/a\ | ||
options { caseInsensitive = true; }' "$destination_file" | ||
|
||
echo "File copied and modified successfully." | ||
} | ||
|
||
synchronize_parser_grammar () { | ||
license_header="$1" | ||
source_file="$PARENT_DIR/elasticsearch/x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4" | ||
destination_file="./packages/kbn-monaco/src/esql/antlr/esql_parser.g4" | ||
|
||
# Copy the file | ||
cp "$source_file" "$destination_file" | ||
|
||
# Insert the license header | ||
temp_file=$(mktemp) | ||
printf "%s\n\n// DO NOT MODIFY THIS FILE BY HAND. IT IS MANAGED BY A CI JOB.\n\n%s" "$license_header" "$(cat ${destination_file})" > "$temp_file" | ||
mv "$temp_file" "$destination_file" | ||
|
||
# Replace the line containing "parser grammar" with "parser grammar esql_parser;" | ||
sed -i -e 's/parser grammar.*$/parser grammar esql_parser;/' "$destination_file" | ||
|
||
# Replace options {tokenVocab=EsqlBaseLexer;} with options {tokenVocab=esql_lexer;} | ||
sed -i -e 's/options {tokenVocab=EsqlBaseLexer;}/options {tokenVocab=esql_lexer;}/' "$destination_file" | ||
|
||
echo "File copied and modified successfully." | ||
} | ||
|
||
report_main_step () { | ||
echo "--- $1" | ||
} | ||
|
||
main () { | ||
cd "$PARENT_DIR" | ||
|
||
report_main_step "Cloning repositories" | ||
|
||
rm -rf elasticsearch | ||
git clone https://github.com/elastic/elasticsearch --depth 1 | ||
|
||
rm -rf open-source | ||
git clone https://github.com/elastic/open-source --depth 1 | ||
|
||
cd "$KIBANA_DIR" | ||
|
||
license_header=$(cat "$PARENT_DIR/open-source/legal/elastic-license-2.0-header.txt") | ||
|
||
report_main_step "Synchronizing lexer grammar..." | ||
synchronize_lexer_grammar "$license_header" | ||
|
||
report_main_step "Synchronizing parser grammar..." | ||
synchronize_parser_grammar "$license_header" | ||
|
||
# Check for differences | ||
set +e | ||
git diff --exit-code --quiet "$destination_file" | ||
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 '[email protected]' | ||
|
||
PR_TITLE='[ES|QL] Update grammars' | ||
PR_BODY='This PR updates the ES|QL grammars (lexer and parser) to match the latest version in 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. Proceeding." | ||
|
||
report_main_step "Building ANTLR artifacts." | ||
|
||
# Bootstrap Kibana | ||
.buildkite/scripts/bootstrap.sh | ||
|
||
# Build ANTLR stuff | ||
cd ./packages/kbn-monaco/src | ||
yarn build:antlr4:esql | ||
|
||
# Make a commit | ||
BRANCH_NAME="esql_grammar_sync_$(date +%s)" | ||
|
||
git checkout -b "$BRANCH_NAME" | ||
|
||
git add -A | ||
git commit -m "Update ES|QL grammars" | ||
|
||
report_main_step "Changes committed. Creating pull request." | ||
|
||
git remote add kibanamachine https://github.com/kibanamachine/kibana.git | ||
git push kibanamachine "$BRANCH_NAME" | ||
|
||
# Create a PR | ||
gh pr create --draft --title "$PR_TITLE" --body "$PR_BODY" --base main --head "kibanamachine:${BRANCH_NAME}" --label 'release_note:skip' --label 'Team:Visualizations' | ||
} | ||
|
||
main |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.