Skip to content

Commit 9e18f75

Browse files
authored
Merge branch 'main' into make-score-required
2 parents 904847f + 5b1e0ef commit 9e18f75

File tree

2,573 files changed

+513582
-268896
lines changed

Some content is hidden

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

2,573 files changed

+513582
-268896
lines changed

.backportrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"repoOwner": "elastic",
3+
"repoName": "elasticsearch-specification",
4+
"targetBranchChoices": ["9.1", "9.0", "8.19", "8.18"],
5+
"fork": false
6+
}

.buildkite/kibana.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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 "--- Install dependencies"
9+
lsb_release -a
10+
apt-get update -y
11+
apt-get install -y unzip
12+
13+
echo "--- Clone elasticsearch-js"
14+
git clone -v -- [email protected]:elastic/elasticsearch-js.git
15+
16+
echo "--- Clone elastic-client-generator-js"
17+
git clone -v -- [email protected]:elastic/elastic-client-generator-js.git
18+
mkdir elastic-client-generator-js/output
19+
20+
echo "--- Clone Kibana"
21+
git clone -v --reference /usr/local/git-references/git-github-com-elastic-kibana-git -- [email protected]:elastic/kibana.git
22+
pushd kibana
23+
24+
echo "--- Install Node.js and Yarn"
25+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
26+
set +e # https://github.com/nvm-sh/nvm/issues/3117
27+
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
28+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
29+
set -e
30+
31+
nvm install
32+
nvm use
33+
npm install --global yarn
34+
popd
35+
36+
echo "--- Install elasticsearch-js"
37+
pushd elasticsearch-js
38+
npm install
39+
node .buildkite/make.mjs --task codegen main
40+
npm run build
41+
npm pack
42+
popd
43+
44+
pushd kibana
45+
yarn add ../elasticsearch-js/elastic-elasticsearch-*.tgz
46+
47+
echo "--- Bootstrap Kibana"
48+
git --no-pager diff
49+
yarn kbn bootstrap --allow-root
50+
51+
echo "--- Check types"
52+
node scripts/type_check.js

.buildkite/kibana.yml

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

.gitattributes

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,13 +232,8 @@ dist/* binary
232232

233233
### Linguist Overrides #############################################################################
234234

235-
output/dangling-types/dangling.csv linguist-generated=true
236-
output/schema/schema.json linguist-generated=true
237-
output/openapi/elasticsearch-serverless-openapi.json linguist-generated=true
238-
output/schema/import-type-graph.json linguist-generated=true
239-
output/schema/import-namespace-graph-compact.json linguist-generated=true
240-
output/schema/import-namespace-graph-expanded.json linguist-generated=true
241-
output/schema/validation-errors.json linguist-generated=true
242-
output/typescript/types.ts linguist-generated=true
235+
output/** linguist-generated=true
236+
output/schema/validation-errors.json linguist-generated=false
237+
compiler-rs/compiler-wasm-lib/pkg/* linguist-generated=true
243238

244239
####################################################################################################

.github/CODEOWNERS

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/specification/ml/** @elastic/ml-core @elastic/ml-ui
33

44
# Specification tooling owners
5-
/.github/ @elastic/clients-team
6-
/compiler/ @elastic/clients-team
7-
/compiler-rs/ @elastic/clients-team
8-
/typescript-generator/ @elastic/clients-team
9-
/specification/_json_spec/ @elastic/clients-team
10-
/specification/_spec_utils/ @elastic/clients-team
5+
/.github/ @elastic/devtools-team
6+
/compiler/ @elastic/devtools-team
7+
/compiler-rs/ @elastic/devtools-team
8+
/typescript-generator/ @elastic/devtools-team
9+
/specification/_json_spec/ @elastic/devtools-team
10+
/specification/_spec_utils/ @elastic/devtools-team

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1 @@
1-
<!--
2-
3-
Hello there!
4-
5-
Thank you for opening a pull request!
6-
Please make sure to follow the steps below when opening a pr:
7-
8-
- Sign the CLA https://www.elastic.co/contributor-agreement/
9-
- Tag the relative issue (if any) and give a brief explanation on what your changes are doing
10-
- If you did a spec change, remember to generate again the outputs, you can do it by running `make contrib`
11-
- Add the appropriate backport labels. If you need to backport a breaking change (e.g. changing the structure of a type or changing the type/optionality of a field), please follow these rules:
12-
- If the API is unusable without the change -> every supported version
13-
- If the API is usable, but fix is on the response side -> every supported version
14-
- If the API is usable, but fix is on the request side -> no backport, unless the API is _partially_ usable and the fix unlocks a missing feature that has no workaround
15-
16-
Happy coding!
17-
18-
-->
1+
<!-- Hello there! Thank you for opening a pull request. See CONTRIBUTING.md for instructions. -->

.github/download-artifacts/index.js

Lines changed: 37 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,48 @@
1717
* under the License.
1818
*/
1919

20-
'use strict'
21-
22-
const core = require('@actions/core')
23-
const { join } = require('path')
24-
const minimist = require('minimist')
25-
const stream = require('stream')
26-
const { promisify } = require('util')
27-
const { createWriteStream, promises } = require('fs')
28-
const rimraf = require('rimraf')
29-
const fetch = require('node-fetch')
30-
const crossZip = require('cross-zip')
20+
import core from '@actions/core'
21+
import { join, dirname } from 'path'
22+
import { fileURLToPath } from 'url'
23+
import minimist from 'minimist'
24+
import stream from 'stream'
25+
import { promisify } from 'util'
26+
import { createWriteStream, promises } from 'fs'
27+
import { rimraf } from 'rimraf'
28+
import fetch from 'node-fetch'
29+
import crossZip from 'cross-zip'
3130

3231
const { mkdir, rename, readdir, unlink } = promises
3332
const pipeline = promisify(stream.pipeline)
3433
const unzip = promisify(crossZip.unzip)
35-
const rm = promisify(rimraf)
3634

35+
const __filename = fileURLToPath(import.meta.url)
36+
const __dirname = dirname(__filename)
3737
const esFolder = join(__dirname, '..', '..', 'artifacts')
3838
const zipFolder = join(esFolder, 'artifacts.zip')
3939
const downloadedSpec = join(esFolder, 'rest-api-spec', 'api')
4040
const specFolder = join(__dirname, '..', '..', 'specification', '_json_spec')
4141

4242
async function downloadArtifacts (opts) {
43-
if (typeof opts.version !== 'string' && typeof opts.branch !== 'string') {
44-
throw new Error('Missing version or branch')
43+
if (typeof opts.branch !== 'string') {
44+
throw new Error('Missing branch')
4545
}
4646

47-
core.info('Checking out spec and test')
47+
core.info('Resolving artifact URL')
4848

49-
core.info('Resolving version')
5049
let resolved
5150
try {
52-
resolved = await resolve(opts.version || fromBranch(opts.branch), opts.hash)
51+
resolved = await resolve(opts.branch)
5352
} catch (err) {
5453
core.error(err.message)
5554
process.exit(1)
5655
}
5756

58-
opts.version = resolved.version
59-
core.info(`Resolved version ${opts.version}`)
57+
core.info(`Resolved artifact URL for ${resolved.commit_url}`)
6058

6159
core.info('Cleanup')
62-
await rm(esFolder)
63-
await rm(specFolder)
60+
await rimraf(esFolder)
61+
await rimraf(specFolder)
6462
await mkdir(esFolder, { recursive: true })
6563
await mkdir(specFolder, { recursive: true })
6664

@@ -76,7 +74,7 @@ async function downloadArtifacts (opts) {
7674
await unzip(zipFolder, esFolder)
7775

7876
core.info('Cleanup')
79-
await rm(zipFolder)
77+
await rimraf(zipFolder)
8078

8179
core.info('Moving files')
8280
const files = await readdir(downloadedSpec)
@@ -96,74 +94,29 @@ async function downloadArtifacts (opts) {
9694
core.info('Done')
9795
}
9896

99-
async function resolve (version, hash) {
100-
if (version === 'latest') {
101-
const response = await fetch('https://artifacts-api.elastic.co/v1/versions')
102-
if (!response.ok) {
103-
throw new Error(`unexpected response ${response.statusText}`)
104-
}
105-
const { versions } = await response.json()
106-
version = versions.pop()
97+
async function resolve (branch) {
98+
if (branch == 'main') {
99+
branch = 'master'
107100
}
108-
109-
core.info(`Resolving version ${version}`)
110-
const response = await fetch(`https://artifacts-api.elastic.co/v1/versions/${version}`)
101+
const url = `https://artifacts-snapshot.elastic.co/elasticsearch/latest/${branch}.json`
102+
const response = await fetch(url)
111103
if (!response.ok) {
112-
throw new Error(`unexpected response ${response.statusText}`)
104+
throw new Error(`Unexpected response. Invalid version? ${url}: ${response.statusText}`)
113105
}
114-
115106
const data = await response.json()
116-
const esBuilds = data.version.builds
117-
.filter(build => build.projects.elasticsearch != null)
118-
.map(build => {
119-
return {
120-
projects: build.projects.elasticsearch,
121-
buildId: build.build_id,
122-
date: build.start_time,
123-
version: build.version
124-
}
125-
})
126-
.sort((a, b) => {
127-
const dA = new Date(a.date)
128-
const dB = new Date(b.date)
129-
if (dA > dB) return -1
130-
if (dA < dB) return 1
131-
return 0
132-
})
133-
134-
if (hash != null) {
135-
const build = esBuilds.find(build => build.projects.commit_hash === hash)
136-
if (!build) {
137-
throw new Error(`Can't find any build with hash '${hash}'`)
138-
}
139-
const zipKey = Object.keys(build.projects.packages).find(key => key.startsWith('rest-resources-zip-') && key.endsWith('.zip'))
140-
return {
141-
url: build.projects.packages[zipKey].url,
142-
id: build.buildId,
143-
hash: build.projects.commit_hash,
144-
version: build.version
145-
}
146-
}
147107

148-
const lastBuild = esBuilds[0]
149-
const zipKey = Object.keys(lastBuild.projects.packages).find(key => key.startsWith('rest-resources-zip-') && key.endsWith('.zip'))
150-
return {
151-
url: lastBuild.projects.packages[zipKey].url,
152-
id: lastBuild.buildId,
153-
hash: lastBuild.projects.commit_hash,
154-
version: lastBuild.version
108+
let manifest_url = data.manifest_url
109+
const manifestResponse = await fetch(manifest_url)
110+
if (!manifestResponse.ok) {
111+
throw new Error(`Unexpected manifestResponse. ${manifest_url}: ${manifestResponse.statusText}`)
155112
}
156-
}
113+
const manifestData = await manifestResponse.json()
114+
const elasticsearch = manifestData.projects.elasticsearch
115+
const restResourceName = `rest-resources-zip-${manifestData.version}.zip`
157116

158-
function fromBranch (branch) {
159-
if (branch === 'main') {
160-
return 'latest'
161-
} else if (branch === '7.x') {
162-
return '7.x-SNAPSHOT'
163-
} else if ((branch.startsWith('7.') || branch.startsWith('8.')) && !isNaN(Number(branch.split('.')[1]))) {
164-
return `${branch}-SNAPSHOT`
165-
} else {
166-
throw new Error(`Cannot derive version from branch '${branch}'`)
117+
return {
118+
url: elasticsearch.packages[restResourceName].url,
119+
commit_url: elasticsearch.commit_url,
167120
}
168121
}
169122

@@ -172,7 +125,7 @@ async function main (options) {
172125
}
173126

174127
const options = minimist(process.argv.slice(2), {
175-
string: ['id', 'version', 'hash', 'branch']
128+
string: ['branch']
176129
})
177130
main(options).catch(t => {
178131
core.error(t)

.github/download-artifacts/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"name": "download-artifacts",
33
"version": "1.0.0",
44
"description": "",
5+
"type": "module",
56
"main": "index.js",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1"
@@ -13,7 +14,7 @@
1314
"@actions/core": "^1.6.0",
1415
"cross-zip": "^4.0.0",
1516
"minimist": "^1.2.5",
16-
"node-fetch": "^2.6.7",
17-
"rimraf": "^3.0.2"
17+
"node-fetch": "^3",
18+
"rimraf": "^6"
1819
}
1920
}

.github/labeler.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
documentation:
2-
- '*.md'
2+
- changed-files:
3+
- any-glob-to-any-file: '*.md'
34

45
specification:
5-
- 'specification/**/*'
6+
- changed-files:
7+
- any-glob-to-any-file: 'specification/**/*'
68

79
generator:typescript:
8-
- 'typescript-generator/**/*'
10+
- changed-files:
11+
- any-glob-to-any-file: 'typescript-generator/**/*'
912

1013
compiler:
11-
- 'compiler/**/*'
12-
- 'compiler-rs/**/*'
14+
- changed-files:
15+
- any-glob-to-any-file: ['compiler/**/*', 'compiler-rs/**/*']

0 commit comments

Comments
 (0)