Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
KOTungseth committed Apr 5, 2022
2 parents 95983fe + 5ad7864 commit d46498a
Show file tree
Hide file tree
Showing 1,973 changed files with 60,079 additions and 24,617 deletions.
3 changes: 2 additions & 1 deletion .backportrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"repoName": "kibana",
"targetBranchChoices": [
"main",
"8.2",
"8.1",
"8.0",
"7.17",
Expand Down Expand Up @@ -38,7 +39,7 @@
"backport"
],
"branchLabelMapping": {
"^v8.2.0$": "main",
"^v8.3.0$": "main",
"^v(\\d+).(\\d+).\\d+$": "$1.$2"
},
"autoMerge": true,
Expand Down
26 changes: 26 additions & 0 deletions .buildkite/pipelines/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,29 @@ steps:
agents:
queue: c2-16
timeout_in_minutes: 60

- wait

- command: TEST_PACKAGE=deb .buildkite/scripts/steps/package_testing/test.sh
label: Package testing for deb
agents:
queue: n2-4-virt
timeout_in_minutes: 20

- command: TEST_PACKAGE=rpm .buildkite/scripts/steps/package_testing/test.sh
label: Package testing for rpm
agents:
queue: n2-4-virt
timeout_in_minutes: 20

- command: TEST_PACKAGE=docker .buildkite/scripts/steps/package_testing/test.sh
label: Package testing for docker
agents:
queue: n2-4-virt
timeout_in_minutes: 20

- command: .buildkite/scripts/steps/artifacts/docker_context.sh
label: 'Docker Build Context'
agents:
queue: n2-2
timeout_in_minutes: 20
16 changes: 8 additions & 8 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ steps:
- command: .buildkite/scripts/steps/functional/oss_accessibility.sh
label: 'OSS Accessibility Tests'
agents:
queue: ci-group-4d
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand All @@ -67,7 +67,7 @@ steps:
- command: .buildkite/scripts/steps/functional/xpack_accessibility.sh
label: 'Default Accessibility Tests'
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand All @@ -78,7 +78,7 @@ steps:
- command: .buildkite/scripts/steps/functional/oss_firefox.sh
label: 'OSS Firefox Tests'
agents:
queue: ci-group-4d
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand All @@ -89,7 +89,7 @@ steps:
- command: .buildkite/scripts/steps/functional/xpack_firefox.sh
label: 'Default Firefox Tests'
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand All @@ -100,7 +100,7 @@ steps:
- command: .buildkite/scripts/steps/functional/oss_misc.sh
label: 'OSS Misc Functional Tests'
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand All @@ -111,7 +111,7 @@ steps:
- command: .buildkite/scripts/steps/functional/xpack_saved_object_field_metrics.sh
label: 'Saved Object Field Metrics'
agents:
queue: n2-4
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
retry:
Expand All @@ -138,7 +138,7 @@ steps:
- command: .buildkite/scripts/steps/test/api_integration.sh
label: 'API Integration Tests'
agents:
queue: n2-2
queue: n2-2-spot
timeout_in_minutes: 120
key: api-integration

Expand Down Expand Up @@ -173,7 +173,7 @@ steps:
- command: .buildkite/scripts/steps/build_api_docs.sh
label: 'Build API Docs'
agents:
queue: n2-4
queue: n2-4-spot
key: build_api_docs
timeout_in_minutes: 60

Expand Down
1 change: 1 addition & 0 deletions .buildkite/scripts/build_kibana_plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -euo pipefail

echo "--- Build Platform Plugins"
node scripts/build_kibana_platform_plugins \
--scan-dir "$KIBANA_DIR/test/analytics/__fixtures__/plugins" \
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
--scan-dir "$KIBANA_DIR/test/interpreter_functional/plugins" \
--scan-dir "$KIBANA_DIR/test/common/fixtures/plugins" \
Expand Down
5 changes: 5 additions & 0 deletions .buildkite/scripts/common/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ check_for_changed_files() {

git commit -m "$NEW_COMMIT_MESSAGE"
git push

# After the git push, the new commit will trigger a new build within a few seconds and this build should get cancelled
# So, let's just sleep to give the build time to cancel itself without an error
# If it doesn't get cancelled for some reason, then exit with an error, because we don't want this build to be green (we just don't want it to generate an error either)
sleep 300
exit 1
else
echo -e "\n${RED}ERROR: '$1' caused changes to the following files:${C_RESET}\n"
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/lifecycle/annotate_test_failures.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-unresolved
const { TestFailures } = require('kibana-buildkite-library');

(async () => {
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/lifecycle/build_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-unresolved
const { BuildkiteClient } = require('kibana-buildkite-library');

(async () => {
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_complete.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-unresolved
const { CiStats } = require('kibana-buildkite-library');

(async () => {
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-unresolved
const { CiStats } = require('kibana-buildkite-library');

(async () => {
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/lifecycle/ci_stats_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-unresolved
const { CiStats } = require('kibana-buildkite-library');

(async () => {
Expand Down
1 change: 1 addition & 0 deletions .buildkite/scripts/lifecycle/post_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

set -euo pipefail

echo '--- Agent Debug Info'
node .buildkite/scripts/lifecycle/print_agent_links.js || true

IS_TEST_EXECUTION_STEP="$(buildkite-agent meta-data get "${BUILDKITE_JOB_ID}_is_test_execution_step" --default '')"
Expand Down
9 changes: 9 additions & 0 deletions .buildkite/scripts/lifecycle/pre_command.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ retry 5 15 install_deps

cd ..

echo '--- Agent Debug/SSH Info'
node .buildkite/scripts/lifecycle/print_agent_links.js || true

if [[ "$(curl -is metadata.google.internal || true)" ]]; then
echo ""
echo "To SSH into this agent, run:"
echo "gcloud compute ssh --tunnel-through-iap --project elastic-kibana-ci --zone \"$(curl -sH Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/zone)\" \"$(curl -sH Metadata-Flavor:Google http://metadata.google.internal/computeMetadata/v1/instance/name)\""
echo ""
fi


echo '--- Job Environment Setup'

# Set up a custom ES Snapshot Manifest if one has been specified for this build
Expand Down
2 changes: 0 additions & 2 deletions .buildkite/scripts/lifecycle/print_agent_links.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* Side Public License, v 1.
*/

// eslint-disable-next-line import/no-unresolved
const { BuildkiteClient } = require('kibana-buildkite-library');

(async () => {
Expand All @@ -31,7 +30,6 @@ const { BuildkiteClient } = require('kibana-buildkite-library');
`?time=${startTime.getTime()}`,
].join('');

console.log('--- Agent Debug Links');
console.log('Agent Metrics:');
console.log('\u001b]1339;' + `url='${METRICS_URL}'\u0007`);
console.log('Agent Logs:');
Expand Down
1 change: 0 additions & 1 deletion .buildkite/scripts/pipelines/pull_request/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

const execSync = require('child_process').execSync;
const fs = require('fs');
// eslint-disable-next-line import/no-unresolved
const { areChangesSkippable, doAnyChangesMatch } = require('kibana-buildkite-library');

const SKIPPABLE_PATHS = [
Expand Down
28 changes: 28 additions & 0 deletions .buildkite/scripts/steps/artifacts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,31 @@ node scripts/build "$RELEASE_ARG" --all-platforms --debug --docker-cross-compile

echo "--- Build dependencies report"
node scripts/licenses_csv_report "--csv=target/dependencies-$VERSION.csv"

# Release verification
if [[ "${RELEASE_BUILD:-}" == "true" ]]; then
echo "--- Build and push Kibana Cloud Distribution"
# This doesn't meet the requirements for a release image, implementation TBD
# Beats artifacts will need to match a specific commit sha that matches other stack iamges
# For now this is a placeholder step that will allow us to run automated Cloud tests
# against a best guess approximation of a release image
echo "$KIBANA_DOCKER_PASSWORD" | docker login -u "$KIBANA_DOCKER_USERNAME" --password-stdin docker.elastic.co
trap 'docker logout docker.elastic.co' EXIT

node scripts/build \
"$RELEASE_ARG" \
--skip-initialize \
--skip-generic-folders \
--skip-platform-folders \
--skip-archives \
--docker-images \
--docker-tag-qualifier="$GIT_COMMIT" \
--docker-push \
--skip-docker-ubi \
--skip-docker-ubuntu \
--skip-docker-contexts
fi

cd target
buildkite-agent artifact upload "*"
cd -
28 changes: 28 additions & 0 deletions .buildkite/scripts/steps/artifacts/docker_context.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

set -euo pipefail

.buildkite/scripts/bootstrap.sh

if [[ "${RELEASE_BUILD:-}" == "true" ]]; then
VERSION="$(jq -r '.version' package.json)"
RELEASE_ARG="--release"
else
VERSION="$(jq -r '.version' package.json)-SNAPSHOT"
RELEASE_ARG=""
fi

echo "--- Create contexts"
mkdir -p target
node scripts/build "$RELEASE_ARG" --skip-initialize --skip-generic-folders --skip-platform-folders --skip-archives --docker-context-use-local-artifact

echo "--- Setup default context"
DOCKER_BUILD_FOLDER=$(mktemp -d)

tar -xf target/kibana-[0-9]*-docker-build-context.tar.gz -C "$DOCKER_BUILD_FOLDER"
cd $DOCKER_BUILD_FOLDER

buildkite-agent artifact download "kibana-$VERSION-linux-x86_64.tar.gz" . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"

echo "--- Build context"
docker build .
8 changes: 8 additions & 0 deletions .buildkite/scripts/steps/functional/oss_misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ checks-reporter-with-killswitch "Status Integration Tests" \
--config test/server_integration/http/platform/config.status.ts \
--bail \
--debug

# Tests that must be run against source in order to build test plugins
echo --- Analytics Integration Tests
checks-reporter-with-killswitch "Analytics Integration Tests" \
node scripts/functional_tests \
--config test/analytics/config.ts \
--bail \
--debug
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/functional/synthetics.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ echo "--- Uptime @elastic/synthetics Tests"
cd "$XPACK_DIR"

checks-reporter-with-killswitch "Uptime @elastic/synthetics Tests" \
node plugins/uptime/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --grep "MonitorManagement*"
node plugins/uptime/scripts/e2e.js --kibana-install-dir "$KIBANA_BUILD_LOCATION" --grep "MonitorManagement-monitor*"
20 changes: 19 additions & 1 deletion .buildkite/scripts/steps/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,25 @@ source .buildkite/scripts/common/util.sh
echo '--- Lint: stylelint'
checks-reporter-with-killswitch "Lint: stylelint" \
node scripts/stylelint
echo "stylelint ✅"

# disable "Exit immediately" mode so that we can run eslint, capture it's exit code, and respond appropriately
# after possibly commiting fixed files to the repo
set +e;

echo '--- Lint: eslint'
checks-reporter-with-killswitch "Lint: eslint" \
node scripts/eslint --no-cache
node scripts/eslint --no-cache --fix

eslint_exit=$?

# re-enable "Exit immediately" mode
set -e;

check_for_changed_files 'node scripts/eslint --no-cache --fix' true

if [[ "${eslint_exit}" != "0" ]]; then
exit 1
fi

echo "eslint ✅"
2 changes: 1 addition & 1 deletion .buildkite/scripts/steps/test/jest_parallel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exitCode=0
while read -r config; do
if [ "$((i % JOB_COUNT))" -eq "$JOB" ]; then
echo "--- $ node scripts/jest --config $config"
node --max-old-space-size=14336 ./node_modules/.bin/jest --config="$config" --runInBand --coverage=false --passWithNoTests
node --max-old-space-size=14336 ./scripts/jest --config="$config" --runInBand --coverage=false --passWithNoTests
lastCode=$?

if [ $lastCode -ne 0 ]; then
Expand Down
Loading

0 comments on commit d46498a

Please sign in to comment.