Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into telemetry/rem…
Browse files Browse the repository at this point in the history
…ove_request_package
  • Loading branch information
Bamieh committed Sep 9, 2021
2 parents 9124470 + dd69697 commit 1cd3c5b
Show file tree
Hide file tree
Showing 3,093 changed files with 126,636 additions and 89,016 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 5 additions & 0 deletions .buildkite/pipelines/es_snapshots/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
steps:
- command: .buildkite/scripts/steps/es_snapshots/build.sh
label: Build ES Snapshot
agents:
queue: c2-8
12 changes: 12 additions & 0 deletions .buildkite/pipelines/es_snapshots/promote.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
steps:
- block: 'Promote'
prompt: "Enter the details for the snapshot you'd like to promote"
if: "build.env('ES_SNAPSHOT_MANIFEST') == null"
# Later, this could be a dropdown dynamically filled with recent builds
fields:
- text: 'ES_SNAPSHOT_MANIFEST'
key: 'ES_SNAPSHOT_MANIFEST'
hint: 'URL pointing to the manifest to promote'
required: true
- label: Promote Snapshot
command: .buildkite/scripts/steps/es_snapshots/promote.sh
102 changes: 102 additions & 0 deletions .buildkite/pipelines/es_snapshots/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
env:
IGNORE_SHIP_CI_STATS_ERROR: 'true'
steps:
- block: 'Verify'
prompt: "Enter the details for the snapshot you'd like to verify"
if: "build.env('ES_SNAPSHOT_MANIFEST') == null"
# Later, this could be a dropdown dynamically filled with recent builds
fields:
- text: 'ES_SNAPSHOT_MANIFEST'
key: 'ES_SNAPSHOT_MANIFEST'
hint: 'URL pointing to the manifest to promote'
required: true

- command: .buildkite/scripts/lifecycle/pre_build.sh
label: Pre-Build

- wait

- command: .buildkite/scripts/steps/build_kibana.sh
label: Build Kibana Distribution and Plugins
agents:
queue: c2-8
key: build
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"

- command: .buildkite/scripts/steps/functional/xpack_cigroup.sh
label: 'Default CI Group'
parallelism: 13
agents:
queue: ci-group-6
artifact_paths: target/junit/**/*.xml
depends_on: build
key: default-cigroup
retry:
automatic:
- exit_status: '*'
limit: 1

- command: CI_GROUP=Docker .buildkite/scripts/steps/functional/xpack_cigroup.sh
label: 'Docker CI Group'
agents:
queue: ci-group-6
artifact_paths: target/junit/**/*.xml
depends_on: build
key: default-cigroup-docker
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/functional/oss_cigroup.sh
label: 'OSS CI Group'
parallelism: 12
agents:
queue: ci-group-4d
artifact_paths: target/junit/**/*.xml
depends_on: build
key: oss-cigroup
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/test/jest_integration.sh
label: 'Jest Integration Tests'
agents:
queue: jest
artifact_paths: target/junit/**/*.xml
key: jest-integration
retry:
automatic:
- exit_status: '*'
limit: 1

- command: .buildkite/scripts/steps/test/api_integration.sh
label: 'API Integration Tests'
agents:
queue: jest
artifact_paths: target/junit/**/*.xml
key: api-integration

- command: .buildkite/scripts/steps/es_snapshots/trigger_promote.sh
label: Trigger promotion
depends_on:
- default-cigroup
- default-cigroup-docker
- oss-cigroup
- jest-integration
- api-integration

- wait: ~
continue_on_failure: true

- plugins:
- junit-annotate#v1.9.0:
artifacts: target/junit/**/*.xml

- wait: ~
continue_on_failure: true

- command: .buildkite/scripts/lifecycle/post_build.sh
label: Post-Build
2 changes: 1 addition & 1 deletion .buildkite/scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
source .buildkite/scripts/common/util.sh

echo "--- yarn install and bootstrap"
yarn kbn bootstrap --verbose
yarn kbn bootstrap

###
### upload ts-refs-cache artifacts as quickly as possible so they are available for download
Expand Down
3 changes: 1 addition & 2 deletions .buildkite/scripts/build_kibana_plugins.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ node scripts/build_kibana_platform_plugins \
--scan-dir "$XPACK_DIR/test/licensing_plugin/plugins" \
--scan-dir "$XPACK_DIR/test/usage_collection/plugins" \
--scan-dir "$XPACK_DIR/test/security_functional/fixtures/common" \
--scan-dir "$XPACK_DIR/examples" \
--verbose
--scan-dir "$XPACK_DIR/examples"

echo "--- Archive built plugins"
shopt -s globstar
Expand Down
1 change: 1 addition & 0 deletions .buildkite/scripts/common/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ export TEST_ES_URL="http://elastic:changeme@localhost:6102"
export TEST_ES_TRANSPORT_PORT=6301-6309
export TEST_CORS_SERVER_PORT=6106
export ALERTING_PROXY_PORT=6105
export TEST_PROXY_SERVER_PORT=6107
4 changes: 2 additions & 2 deletions .buildkite/scripts/download_build_artifacts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ if [[ ! -d "$KIBANA_BUILD_LOCATION/bin" ]]; then

cd "$WORKSPACE"

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

mkdir -p "$KIBANA_BUILD_LOCATION"
tar -xzf kibana-default.tar.gz -C "$KIBANA_BUILD_LOCATION" --strip=1
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/scripts/lifecycle/build_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ const { BuildkiteClient } = require('kibana-buildkite-library');
console.log(status.success ? 'true' : 'false');
process.exit(0);
} catch (ex) {
console.error('Buildkite API Error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Body', ex.response.data);
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
console.error(ex);
process.exit(1);
}
})();
6 changes: 5 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ const { CiStats } = require('kibana-buildkite-library');
try {
await CiStats.onComplete();
} catch (ex) {
console.error(ex);
console.error('CI Stats Error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
process.exit(1);
}
})();
6 changes: 5 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ const { CiStats } = require('kibana-buildkite-library');
try {
await CiStats.onStart();
} catch (ex) {
console.error(ex);
console.error('CI Stats Error', ex.message);
if (ex.response) {
console.error('HTTP Error Response Status', ex.response.status);
console.error('HTTP Error Response Body', ex.response.data);
}
process.exit(1);
}
})();
5 changes: 5 additions & 0 deletions .buildkite/scripts/lifecycle/pre_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ if [[ "${SKIP_CI_SETUP:-}" != "true" ]]; then
source .buildkite/scripts/common/setup_bazel.sh
fi
fi

PIPELINE_PRE_COMMAND=${PIPELINE_PRE_COMMAND:-".buildkite/scripts/lifecycle/pipelines/$BUILDKITE_PIPELINE_SLUG/pre_command.sh"}
if [[ -f "$PIPELINE_PRE_COMMAND" ]]; then
source "$PIPELINE_PRE_COMMAND"
fi
8 changes: 8 additions & 0 deletions .buildkite/scripts/steps/build_kibana.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

set -euo pipefail

.buildkite/scripts/bootstrap.sh
.buildkite/scripts/build_kibana.sh
.buildkite/scripts/build_kibana_plugins.sh
.buildkite/scripts/post_build_kibana.sh
4 changes: 4 additions & 0 deletions .buildkite/scripts/steps/es_snapshots/bucket_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
BASE_BUCKET_DAILY: 'kibana-ci-es-snapshots-daily',
BASE_BUCKET_PERMANENT: 'kibana-ci-es-snapshots-permanent',
};
101 changes: 101 additions & 0 deletions .buildkite/scripts/steps/es_snapshots/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/bash

set -euo pipefail

source .buildkite/scripts/common/util.sh

echo "--- Cloning Elasticsearch and preparing workspace"

cd ..
destination="$(pwd)/es-build"
rm -rf "$destination"
mkdir -p "$destination"

mkdir -p elasticsearch && cd elasticsearch

export ELASTICSEARCH_BRANCH="${ELASTICSEARCH_BRANCH:-$BUILDKITE_BRANCH}"

if [[ ! -d .git ]]; then
git init
git remote add origin https://github.com/elastic/elasticsearch.git
fi
git fetch origin --depth 1 "$ELASTICSEARCH_BRANCH"
git reset --hard FETCH_HEAD

ELASTICSEARCH_GIT_COMMIT="$(git rev-parse HEAD)"
export ELASTICSEARCH_GIT_COMMIT

ELASTICSEARCH_GIT_COMMIT_SHORT="$(git rev-parse --short HEAD)"
export ELASTICSEARCH_GIT_COMMIT_SHORT

# These turn off automation in the Elasticsearch repo
export BUILD_NUMBER=""
export JENKINS_URL=""
export BUILD_URL=""
export JOB_NAME=""
export NODE_NAME=""
export DOCKER_BUILDKIT=""

# Reads the ES_BUILD_JAVA env var out of .ci/java-versions.properties and exports it
export "$(grep '^ES_BUILD_JAVA' .ci/java-versions.properties | xargs)"

export PATH="$HOME/.java/$ES_BUILD_JAVA/bin:$PATH"
export JAVA_HOME="$HOME/.java/$ES_BUILD_JAVA"

# The Elasticsearch Dockerfile needs to be built with root privileges, but Docker on our servers is running using a non-root user
# So, let's use docker-in-docker to temporarily create a privileged docker daemon to run `docker build` on
# We have to do this, because there's no `docker build --privileged` or similar

echo "--- Setting up Docker-in-Docker for Elasticsearch"

docker rm -f dind || true # If there's an old daemon running that somehow didn't get cleaned up, lets remove it first
CERTS_DIR="$HOME/dind-certs"
rm -rf "$CERTS_DIR"
docker run -d --rm --privileged --name dind --userns host -p 2377:2376 -e DOCKER_TLS_CERTDIR=/certs -v "$CERTS_DIR":/certs docker:dind

trap "docker rm -f dind" EXIT

export DOCKER_TLS_VERIFY=true
export DOCKER_CERT_PATH="$CERTS_DIR/client"
export DOCKER_TLS_CERTDIR="$CERTS_DIR"
export DOCKER_HOST=localhost:2377

echo "--- Build Elasticsearch"
./gradlew -Dbuild.docker=true assemble --parallel

echo "--- Create distribution archives"
find distribution -type f \( -name 'elasticsearch-*-*-*-*.tar.gz' -o -name 'elasticsearch-*-*-*-*.zip' \) -not -path '*no-jdk*' -not -path '*build-context*' -exec cp {} "$destination" \;

ls -alh "$destination"

echo "--- Create docker image archives"
docker images "docker.elastic.co/elasticsearch/elasticsearch"
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'
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'

echo "--- Create checksums for snapshot files"
cd "$destination"
find ./* -exec bash -c "shasum -a 512 {} > {}.sha512" \;

cd "$BUILDKITE_BUILD_CHECKOUT_PATH"
node "$(dirname "${0}")/create_manifest.js" "$destination"

ES_SNAPSHOT_MANIFEST="$(buildkite-agent meta-data get ES_SNAPSHOT_MANIFEST)"

cat << EOF | buildkite-agent annotate --style "info"
- \`ELASTICSEARCH_BRANCH\` - \`$ELASTICSEARCH_BRANCH\`
- \`ELASTICSEARCH_GIT_COMMIT\` - \`$ELASTICSEARCH_GIT_COMMIT\`
- \`ES_SNAPSHOT_MANIFEST\` - \`$ES_SNAPSHOT_MANIFEST\`
- \`ES_SNAPSHOT_VERSION\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_VERSION)\`
- \`ES_SNAPSHOT_ID\` - \`$(buildkite-agent meta-data get ES_SNAPSHOT_ID)\`
EOF

cat << EOF | buildkite-agent pipeline upload
steps:
- trigger: 'kibana-elasticsearch-snapshot-verify'
async: true
build:
env:
ES_SNAPSHOT_MANIFEST: '$ES_SNAPSHOT_MANIFEST'
branch: '$BUILDKITE_BRANCH'
EOF
Loading

0 comments on commit 1cd3c5b

Please sign in to comment.