Skip to content

Commit e07cc34

Browse files
committed
Merge remote-tracking branch 'origin/main' into kibana-endpoint
2 parents b1e512a + e4cedee commit e07cc34

File tree

1,544 files changed

+76577
-20915
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,544 files changed

+76577
-20915
lines changed

.buildkite/kibana.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
# Since we're into the current repo, move to the top-level
6+
cd ..
7+
8+
echo "--- Clone elasticsearch-js"
9+
git clone -v -- [email protected]:elastic/elasticsearch-js.git
10+
pushd elasticsearch-js
11+
git checkout $BUILDKITE_BRANCH
12+
popd
13+
14+
echo "--- Clone Kibana"
15+
git clone -v --reference /usr/local/git-references/git-github-com-elastic-kibana-git -- [email protected]:elastic/kibana.git
16+
cd kibana
17+
18+
echo "--- Install Node.js and Yarn"
19+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
20+
set +e # https://github.com/nvm-sh/nvm/issues/3117
21+
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
22+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
23+
set -e
24+
25+
nvm install
26+
nvm use
27+
npm install --global yarn
28+
29+
echo "--- Install elasticsearch-js"
30+
pushd ../elasticsearch-js
31+
npm install
32+
npm run build
33+
npm pack
34+
popd
35+
yarn add ../elasticsearch-js/elastic-elasticsearch-*.tgz
36+
37+
echo "--- Bootstrap Kibana"
38+
git --no-pager diff
39+
yarn kbn bootstrap --allow-root
40+
41+
echo "--- Check types"
42+
node scripts/type_check.js

.buildkite/kibana.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
agents:
2+
memory: "24G"
3+
cpu: "4"
4+
ephemeralStorage: 15Gi
5+
6+
7+
steps:
8+
- label: "Run Kibana type checks"
9+
command: .buildkite/kibana.sh

.github/validate-pr/index.js

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,37 @@
1919

2020
/* global argv, path, cd */
2121

22-
'use strict'
22+
import { dirname } from 'path'
23+
import { fileURLToPath } from 'url'
24+
import 'zx/globals'
25+
import assert from 'assert'
26+
import * as core from '@actions/core'
27+
import { copyFile } from 'fs/promises'
28+
import * as github from '@actions/github'
29+
import specification from '../../output/schema/schema.json' assert { type: 'json' }
30+
import { run as getReport } from '../../../clients-flight-recorder/scripts/types-validator/index.js'
31+
import {
32+
getNamespace,
33+
getName
34+
} from '../../../clients-flight-recorder/scripts/types-validator/utils.js'
35+
36+
const __dirname = dirname(fileURLToPath(import.meta.url))
2337

24-
require('zx/globals')
25-
const assert = require('assert')
26-
const core = require('@actions/core')
27-
const { copyFile } = require('fs/promises')
28-
const github = require('@actions/github')
2938
const octokit = github.getOctokit(argv.token)
30-
const specification = require('../../output/schema/schema.json')
31-
const getReport = require('../../../clients-flight-recorder/scripts/types-validator')
32-
const { getNamespace, getName } = require('../../../clients-flight-recorder/scripts/types-validator/utils')
3339

3440
const privateNames = ['_global']
3541
const tick = '`'
36-
const tsValidationPath = path.join(__dirname, '..', '..', '..', 'clients-flight-recorder', 'scripts', 'types-validator')
37-
38-
async function run () {
42+
const tsValidationPath = path.join(
43+
__dirname,
44+
'..',
45+
'..',
46+
'..',
47+
'clients-flight-recorder',
48+
'scripts',
49+
'types-validator'
50+
)
51+
52+
async function run() {
3953
await copyFile(
4054
path.join(__dirname, '..', '..', 'output', 'typescript', 'types.ts'),
4155
path.join(tsValidationPath, 'types.ts')
@@ -53,14 +67,20 @@ async function run () {
5367
per_page: 100
5468
})
5569
if (data.length > 0) {
56-
files.push(...data.map(entry => entry.filename))
70+
files.push(
71+
...data
72+
.filter((entry) => entry.status !== 'deleted')
73+
.map((entry) => entry.filename)
74+
)
5775
page += 1
5876
} else {
5977
break
6078
}
6179
}
6280

63-
const specFiles = files.filter(file => file.includes('specification') && !file.includes('compiler/test'))
81+
const specFiles = files.filter(
82+
(file) => file.includes('specification') && !file.includes('compiler/test')
83+
)
6484
const table = []
6585

6686
cd(tsValidationPath)
@@ -163,7 +183,7 @@ function generateResponse (r) {
163183
return `${r.passingResponse}/${r.totalResponse}`
164184
}
165185

166-
run().catch(err => {
186+
run().catch((err) => {
167187
core.error(err)
168188
process.exit(1)
169189
})

.github/validate-pr/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "validate-pr",
33
"version": "1.0.0",
44
"description": "",
5-
"main": "index.js",
5+
"type": "module",
6+
"exports": "./index.js",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
name: Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types: [labeled, unlabeled, opened, reopened, synchronize]
8+
9+
permissions:
10+
pull-requests: "read"
11+
12+
jobs:
13+
check-backport-label:
14+
name: backport label
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: "Check backport label"
19+
env:
20+
GH_TOKEN: ${{ github.token }}
21+
run: |
22+
json_pr_labels='${{ toJSON(github.event.pull_request.labels) }}'
23+
readarray -t pr_labels < <(echo "${json_pr_labels}" | jq -r -c '.[].name')
24+
25+
json_all_labels="$(gh label list --repo ${{ github.repository }} --json name --search "backport" --limit 1000)"
26+
readarray -t all_labels < <(echo "${json_all_labels}" | jq -r -c '.[].name')
27+
28+
declare -A all_backport_labels=()
29+
declare -A all_floating_majors=()
30+
31+
backport_regex="^backport ([0-9])+\.([0-9]+|x)$"
32+
33+
echo "::group::Available Labels"
34+
echo "skip-backport"
35+
36+
for label in "${all_labels[@]}"; do
37+
if [[ "${label}" =~ ${backport_regex} ]]; then
38+
major="${BASH_REMATCH[1]}"
39+
minor="${BASH_REMATCH[2]}"
40+
all_backport_labels["${label}"]=1
41+
echo "${label}"
42+
43+
if [ "${minor}" = "x" ]; then
44+
all_floating_majors["${major}"]=1
45+
fi
46+
fi
47+
done
48+
49+
echo "::endgroup::"
50+
51+
has_backport_label=false
52+
has_skip_backport_label=false
53+
declare -A pr_exact_majors=()
54+
declare -A pr_floating_majors=()
55+
56+
echo "::group::Detected Labels"
57+
58+
for pr_label in "${pr_labels[@]}"; do
59+
if [ "${pr_label}" = "skip-backport" ]; then
60+
has_skip_backport_label=true
61+
echo "${pr_label}"
62+
continue
63+
fi
64+
65+
if [ -z "${all_backport_labels[${pr_label}]}" ]; then
66+
continue
67+
fi
68+
69+
has_backport_label=true
70+
71+
if [[ "${pr_label}" =~ ${backport_regex} ]]; then
72+
major="${BASH_REMATCH[1]}"
73+
minor="${BASH_REMATCH[2]}"
74+
if [ "${minor}" != "x" ]; then
75+
pr_exact_majors["${major}"]=1
76+
else
77+
pr_floating_majors["${major}"]=1
78+
fi
79+
fi
80+
81+
echo "${pr_label}"
82+
done
83+
84+
echo "::endgroup::"
85+
86+
if [ "${has_skip_backport_label}" = true ] && [ "${has_backport_label}" = true ]; then
87+
echo "::error::The 'skip-backport' not be used in combination with another backport"\
88+
"label."
89+
exit 1
90+
fi
91+
92+
if [ "${has_skip_backport_label}" != true ] && [ "${has_backport_label}" != true ]; then
93+
echo "::error::No backport label found. Please add at least one of the"\
94+
"'backport {major}.{minor|x}' labels or use 'skip-backport',"\
95+
"if this PR should not be backported."
96+
exit 1
97+
fi
98+
99+
# Validate that a floating backport label exists for each exact backport label major
100+
# version.
101+
102+
has_required_floating_labels=true
103+
104+
for pr_major in "${!pr_exact_majors[@]}"; do
105+
if [ -z "${all_floating_majors[${pr_major}]}" ]; then
106+
# There is no floating version branch for the given major version.
107+
continue
108+
fi
109+
110+
if [ -z "${pr_floating_majors[${pr_major}]}" ]; then
111+
has_required_floating_labels=false
112+
echo "::error::Missing floating backport label for '${pr_major}.x'"
113+
fi
114+
done
115+
116+
if [ "${has_required_floating_labels}" != true ]; then
117+
exit 1
118+
fi

.github/workflows/gh-pages-report.yml

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

.github/workflows/update-rest-api-json.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
branch: ['main', '8.x', '8.16', '8.17', 7.17']
16+
branch: ['main', '9.0', '8.x', '8.18', '8.17', '8.16', '7.17']
1717

1818
steps:
1919
- uses: actions/checkout@v4
@@ -51,7 +51,7 @@ jobs:
5151
commit-message: 'Update rest-api-spec'
5252
labels: specification
5353
delete-branch: true
54-
reviewers: Anaethelion,ezimuel,flobernd,JoshMock,l-trotta,miguelgrinberg,picandocodigo,pquentin,srikanthmanvi,swallez,technige
54+
reviewers: Anaethelion,ezimuel,flobernd,JoshMock,l-trotta,miguelgrinberg,picandocodigo,pquentin,swallez,technige
5555
branch: automated/rest-api-spec-update-${{ matrix.branch }}
5656

5757
- name: Open an issue if the action fails

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ setup: ## Install dependencies for contrib target
3939
@make clean-dep
4040
@npm install --prefix compiler
4141
@npm install --prefix typescript-generator
42-
@npm install @stoplight/spectral-cli
42+
@npm install @redocly/cli
4343

4444
clean-dep: ## Clean npm dependencies
4545
@rm -rf compiler/node_modules
@@ -57,8 +57,6 @@ filter-for-serverless: ## Generate the serverless version from the compiled sche
5757
dump-routes: ## Create a new schema with all generics expanded
5858
@npm run dump-routes --prefix compiler
5959

60-
contrib: | generate license-check spec-format-fix transform-to-openapi filter-for-serverless ## Pre contribution target
61-
6260
overlay-docs: ## Apply overlays to OpenAPI documents
6361
@npx bump overlay "output/openapi/elasticsearch-serverless-openapi.json" "docs/overlays/elasticsearch-serverless-openapi-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi.tmp1.json"
6462
@npx bump overlay "output/openapi/elasticsearch-serverless-openapi.tmp1.json" "docs/overlays/elasticsearch-shared-overlays.yaml" > "output/openapi/elasticsearch-serverless-openapi.tmp2.json"
@@ -70,13 +68,15 @@ overlay-docs: ## Apply overlays to OpenAPI documents
7068
rm output/openapi/elasticsearch-openapi.tmp*.json
7169

7270
lint-docs: ## Lint the OpenAPI documents after overlays
73-
@npx @stoplight/spectral-cli lint output/openapi/elasticsearch-*.examples.json --ruleset .spectral.yaml
71+
@npx @redocly/cli lint "output/openapi/elasticsearch-*.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
7472

75-
lint-docs-errs: ## Lint the OpenAPI documents after overlays and return only errors
76-
@npx @stoplight/spectral-cli lint output/openapi/elasticsearch-*.examples.json --ruleset .spectral.yaml -D
73+
lint-docs-stateful: ## Lint only the elasticsearch-openapi.examples.json file
74+
@npx @redocly/cli lint "output/openapi/elasticsearch-openapi.examples.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
7775

7876
lint-docs-serverless: ## Lint only the serverless OpenAPI document after overlays
79-
@npx @stoplight/spectral-cli lint output/openapi/elasticsearch-serverless-openapi.examples.json --ruleset .spectral.yaml
77+
@npx @redocly/cli lint "output/openapi/elasticsearch-serverless-openapi.examples.json" --config "docs/linters/redocly.yaml" --format stylish --max-problems 500
78+
79+
contrib: | generate license-check spec-format-fix transform-to-openapi filter-for-serverless lint-docs ## Pre contribution target
8080

8181
help: ## Display help
8282
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

0 commit comments

Comments
 (0)