Skip to content

Commit 0245c0d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 110630-filter-bar-and-date-picker-tests
2 parents 5b19179 + 334f129 commit 0245c0d

File tree

960 files changed

+79056
-68066
lines changed

Some content is hidden

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

960 files changed

+79056
-68066
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
steps:
2+
- command: .buildkite/scripts/steps/es_snapshots/build.sh
3+
label: Build ES Snapshot
4+
agents:
5+
queue: c2-8
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
steps:
2+
- block: 'Promote'
3+
prompt: "Enter the details for the snapshot you'd like to promote"
4+
if: "build.env('ES_SNAPSHOT_MANIFEST') == null"
5+
# Later, this could be a dropdown dynamically filled with recent builds
6+
fields:
7+
- text: 'ES_SNAPSHOT_MANIFEST'
8+
key: 'ES_SNAPSHOT_MANIFEST'
9+
hint: 'URL pointing to the manifest to promote'
10+
required: true
11+
- label: Promote Snapshot
12+
command: .buildkite/scripts/steps/es_snapshots/promote.sh
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
env:
2+
IGNORE_SHIP_CI_STATS_ERROR: 'true'
3+
steps:
4+
- block: 'Verify'
5+
prompt: "Enter the details for the snapshot you'd like to verify"
6+
if: "build.env('ES_SNAPSHOT_MANIFEST') == null"
7+
# Later, this could be a dropdown dynamically filled with recent builds
8+
fields:
9+
- text: 'ES_SNAPSHOT_MANIFEST'
10+
key: 'ES_SNAPSHOT_MANIFEST'
11+
hint: 'URL pointing to the manifest to promote'
12+
required: true
13+
14+
- command: .buildkite/scripts/lifecycle/pre_build.sh
15+
label: Pre-Build
16+
17+
- wait
18+
19+
- command: .buildkite/scripts/steps/build_kibana.sh
20+
label: Build Kibana Distribution and Plugins
21+
agents:
22+
queue: c2-8
23+
key: build
24+
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"
25+
26+
- command: .buildkite/scripts/steps/functional/xpack_cigroup.sh
27+
label: 'Default CI Group'
28+
parallelism: 13
29+
agents:
30+
queue: ci-group-6
31+
artifact_paths: target/junit/**/*.xml
32+
depends_on: build
33+
key: default-cigroup
34+
retry:
35+
automatic:
36+
- exit_status: '*'
37+
limit: 1
38+
39+
- command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh
40+
label: 'Docker CI Group'
41+
agents:
42+
queue: ci-group-6
43+
artifact_paths: target/junit/**/*.xml
44+
depends_on: build
45+
key: default-cigroup-docker
46+
retry:
47+
automatic:
48+
- exit_status: '*'
49+
limit: 1
50+
51+
- command: .buildkite/scripts/steps/functional/oss_cigroup.sh
52+
label: 'OSS CI Group'
53+
parallelism: 12
54+
agents:
55+
queue: ci-group-4d
56+
artifact_paths: target/junit/**/*.xml
57+
depends_on: build
58+
key: oss-cigroup
59+
retry:
60+
automatic:
61+
- exit_status: '*'
62+
limit: 1
63+
64+
- command: .buildkite/scripts/steps/test/jest_integration.sh
65+
label: 'Jest Integration Tests'
66+
agents:
67+
queue: jest
68+
artifact_paths: target/junit/**/*.xml
69+
key: jest-integration
70+
retry:
71+
automatic:
72+
- exit_status: '*'
73+
limit: 1
74+
75+
- command: .buildkite/scripts/steps/test/api_integration.sh
76+
label: 'API Integration Tests'
77+
agents:
78+
queue: jest
79+
artifact_paths: target/junit/**/*.xml
80+
key: api-integration
81+
82+
- command: .buildkite/scripts/steps/es_snapshots/trigger_promote.sh
83+
label: Trigger promotion
84+
depends_on:
85+
- default-cigroup
86+
- default-cigroup-docker
87+
- oss-cigroup
88+
- jest-integration
89+
- api-integration
90+
91+
- wait: ~
92+
continue_on_failure: true
93+
94+
- plugins:
95+
- junit-annotate#v1.9.0:
96+
artifacts: target/junit/**/*.xml
97+
98+
- wait: ~
99+
continue_on_failure: true
100+
101+
- command: .buildkite/scripts/lifecycle/post_build.sh
102+
label: Post-Build

.buildkite/scripts/build_kibana_plugins.sh

100644100755
File mode changed.

.buildkite/scripts/download_build_artifacts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ if [[ ! -d "$KIBANA_BUILD_LOCATION/bin" ]]; then
77

88
cd "$WORKSPACE"
99

10-
buildkite-agent artifact download kibana-default.tar.gz .
11-
buildkite-agent artifact download kibana-default-plugins.tar.gz .
10+
buildkite-agent artifact download kibana-default.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
11+
buildkite-agent artifact download kibana-default-plugins.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
1212

1313
mkdir -p "$KIBANA_BUILD_LOCATION"
1414
tar -xzf kibana-default.tar.gz -C "$KIBANA_BUILD_LOCATION" --strip=1

.buildkite/scripts/lifecycle/pre_command.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ if [[ "${SKIP_CI_SETUP:-}" != "true" ]]; then
7272
source .buildkite/scripts/common/setup_bazel.sh
7373
fi
7474
fi
75+
76+
PIPELINE_PRE_COMMAND=${PIPELINE_PRE_COMMAND:-".buildkite/scripts/lifecycle/pipelines/$BUILDKITE_PIPELINE_SLUG/pre_command.sh"}
77+
if [[ -f "$PIPELINE_PRE_COMMAND" ]]; then
78+
source "$PIPELINE_PRE_COMMAND"
79+
fi
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
.buildkite/scripts/bootstrap.sh
6+
.buildkite/scripts/build_kibana.sh
7+
.buildkite/scripts/build_kibana_plugins.sh
8+
.buildkite/scripts/post_build_kibana.sh
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
BASE_BUCKET_DAILY: 'kibana-ci-es-snapshots-daily',
3+
BASE_BUCKET_PERMANENT: 'kibana-ci-es-snapshots-permanent',
4+
};
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
source .buildkite/scripts/common/util.sh
6+
7+
echo "--- Cloning Elasticsearch and preparing workspace"
8+
9+
cd ..
10+
destination="$(pwd)/es-build"
11+
rm -rf "$destination"
12+
mkdir -p "$destination"
13+
14+
mkdir -p elasticsearch && cd elasticsearch
15+
16+
export ELASTICSEARCH_BRANCH="${ELASTICSEARCH_BRANCH:-$BUILDKITE_BRANCH}"
17+
18+
if [[ ! -d .git ]]; then
19+
git init
20+
git remote add origin https://github.com/elastic/elasticsearch.git
21+
fi
22+
git fetch origin --depth 1 "$ELASTICSEARCH_BRANCH"
23+
git reset --hard FETCH_HEAD
24+
25+
ELASTICSEARCH_GIT_COMMIT="$(git rev-parse HEAD)"
26+
export ELASTICSEARCH_GIT_COMMIT
27+
28+
ELASTICSEARCH_GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)"
29+
export ELASTICSEARCH_GIT_COMMIT_SHORT
30+
31+
# These turn off automation in the Elasticsearch repo
32+
export BUILD_NUMBER=""
33+
export JENKINS_URL=""
34+
export BUILD_URL=""
35+
export JOB_NAME=""
36+
export NODE_NAME=""
37+
export DOCKER_BUILDKIT=""
38+
39+
# Reads the ES_BUILD_JAVA env var out of .ci/java-versions.properties and exports it
40+
export "$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | xargs)"
41+
42+
export PATH="$HOME/.java/$ES_BUILD_JAVA/bin:$PATH"
43+
export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA"
44+
45+
# The Elasticsearch Dockerfile needs to be built with root privileges, but Docker on our servers is running using a non-root user
46+
# So, let's use docker-in-docker to temporarily create a privileged docker daemon to run `docker build` on
47+
# We have to do this, because there's no `docker build --privileged` or similar
48+
49+
echo "--- Setting up Docker-in-Docker for Elasticsearch"
50+
51+
docker rm -f dind || true # If there's an old daemon running that somehow didn't get cleaned up, lets remove it first
52+
CERTS_DIR="$HOME/dind-certs"
53+
rm -rf "$CERTS_DIR"
54+
docker run -d --rm --privileged --name dind --userns host -p 2377:2376 -e DOCKER_TLS_CERTDIR=/certs -v "$CERTS_DIR":/certs docker:dind
55+
56+
trap "docker rm -f dind" EXIT
57+
58+
export DOCKER_TLS_VERIFY=true
59+
export DOCKER_CERT_PATH="$CERTS_DIR/client"
60+
export DOCKER_TLS_CERTDIR="$CERTS_DIR"
61+
export DOCKER_HOST=localhost:2377
62+
63+
echo "--- Build Elasticsearch"
64+
./gradlew -Dbuild.docker=true assemble --parallel
65+
66+
echo "--- Create distribution archives"
67+
find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elasticsearch-*-*-*-*.zip' \) -not -path '*no-jdk*' -not -path '*build-context*' -exec cp {} "$destination" \;
68+
69+
ls -alh "$destination"
70+
71+
echo "--- Create docker image archives"
72+
docker images "docker.elastic.co/elasticsearch/elasticsearch"
73+
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 echo 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'
74+
docker images "docker.elastic.co/elasticsearch/elasticsearch" --format "{{.Tag}}" | xargs -n1 bash -c 'docker save docker.elastic.co/elasticsearch/elasticsearch:${0} | gzip > ../es-build/elasticsearch-${0}-docker-image.tar.gz'
75+
76+
echo "--- Create checksums for snapshot files"
77+
cd "$destination"
78+
find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \;
79+
80+
cd "$BUILDKITE_BUILD_CHECKOUT_PATH"
81+
node "$(dirname "${0}")/create_manifest.js" "$destination"
82+
83+
ES_SNAPSHOT_MANIFEST="$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)"
84+
85+
cat << EOF | buildkite-agent annotate --style "info"
86+
- \`ELASTICSEARCH_BRANCH\` - \`$ELASTICSEARCH_BRANCH\`
87+
- \`ELASTICSEARCH_GIT_COMMIT\` - \`$ELASTICSEARCH_GIT_COMMIT\`
88+
- \`ES_SNAPSHOT_MANIFEST\` - \`$ES_SNAPSHOT_MANIFEST\`
89+
- \`ES_SNAPSHOT_VERSION\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_VERSION)\`
90+
- \`ES_SNAPSHOT_ID\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_ID)\`
91+
EOF
92+
93+
cat << EOF | buildkite-agent pipeline upload
94+
steps:
95+
- trigger: 'kibana-elasticsearch-snapshot-verify'
96+
async: true
97+
build:
98+
env:
99+
ES_SNAPSHOT_MANIFEST: '$ES_SNAPSHOT_MANIFEST'
100+
branch: '$BUILDKITE_BRANCH'
101+
EOF
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
const fs = require('fs');
2+
const { execSync } = require('child_process');
3+
const { BASE_BUCKET_DAILY } = require('./bucket_config.js');
4+
5+
(async () => {
6+
console.log('--- Create ES Snapshot Manifest');
7+
8+
const destination = process.argv[2] || __dirname + '/test';
9+
10+
const ES_BRANCH = process.env.ELASTICSEARCH_BRANCH;
11+
const GIT_COMMIT = process.env.ELASTICSEARCH_GIT_COMMIT;
12+
const GIT_COMMIT_SHORT = process.env.ELASTICSEARCH_GIT_COMMIT_SHORT;
13+
14+
let VERSION = '';
15+
let SNAPSHOT_ID = '';
16+
let DESTINATION = '';
17+
18+
const now = new Date();
19+
20+
// format: yyyyMMdd-HHmmss
21+
const date = [
22+
now.getFullYear(),
23+
(now.getMonth() + 1).toString().padStart(2, '0'),
24+
now.getDate().toString().padStart(2, '0'),
25+
'-',
26+
now.getHours().toString().padStart(2, '0'),
27+
now.getMinutes().toString().padStart(2, '0'),
28+
now.getSeconds().toString().padStart(2, '0'),
29+
].join('');
30+
31+
try {
32+
const files = fs.readdirSync(destination);
33+
const manifestEntries = files
34+
.filter((filename) => !filename.match(/.sha512$/))
35+
.filter((filename) => !filename.match(/.json$/))
36+
.map((filename) => {
37+
const parts = filename.replace('elasticsearch-oss', 'oss').split('-');
38+
39+
VERSION = VERSION || parts[1];
40+
SNAPSHOT_ID = SNAPSHOT_ID || `${date}_${GIT_COMMIT_SHORT}`;
41+
DESTINATION = DESTINATION || `${VERSION}/archives/${SNAPSHOT_ID}`;
42+
43+
return {
44+
filename: filename,
45+
checksum: filename + '.sha512',
46+
url: `https://storage.googleapis.com/${BASE_BUCKET_DAILY}/${DESTINATION}/${filename}`,
47+
version: parts[1],
48+
platform: parts[3],
49+
architecture: parts[4].split('.')[0],
50+
license: parts[0] == 'oss' ? 'oss' : 'default',
51+
};
52+
});
53+
54+
const manifest = {
55+
id: SNAPSHOT_ID,
56+
bucket: `${BASE_BUCKET_DAILY}/${DESTINATION}`.toString(),
57+
branch: ES_BRANCH,
58+
sha: GIT_COMMIT,
59+
sha_short: GIT_COMMIT_SHORT,
60+
version: VERSION,
61+
generated: now.toISOString(),
62+
archives: manifestEntries,
63+
};
64+
65+
const manifestJSON = JSON.stringify(manifest, null, 2);
66+
fs.writeFileSync(`${destination}/manifest.json`, manifestJSON);
67+
68+
console.log('Manifest:', manifestJSON);
69+
70+
execSync(
71+
`
72+
set -euo pipefail
73+
74+
echo '--- Upload files to GCS'
75+
cd "${destination}"
76+
gsutil -m cp -r *.* gs://${BASE_BUCKET_DAILY}/${DESTINATION}
77+
cp manifest.json manifest-latest.json
78+
gsutil cp manifest-latest.json gs://${BASE_BUCKET_DAILY}/${VERSION}
79+
80+
buildkite-agent meta-data set ES_SNAPSHOT_MANIFEST 'https://storage.googleapis.com/${BASE_BUCKET_DAILY}/${DESTINATION}/manifest.json'
81+
buildkite-agent meta-data set ES_SNAPSHOT_VERSION '${VERSION}'
82+
buildkite-agent meta-data set ES_SNAPSHOT_ID '${SNAPSHOT_ID}'
83+
`,
84+
{ shell: '/bin/bash' }
85+
);
86+
} catch (ex) {
87+
console.error(ex);
88+
process.exit(1);
89+
}
90+
})();

0 commit comments

Comments
 (0)