Compare commits

...

6 commits

Author SHA1 Message Date
Dzmitry Lemechko 8613ffaf33 [coverage] increase memory limit to 6gb 2021-11-10 22:46:42 +01:00
Dzmitry Lemechko a0b5eb4580 [coverage] remove verbose flag for jest 2021-11-10 20:44:54 +01:00
Dzmitry Lemechko f5f24061cd [coverage] fix expression 2021-11-09 21:54:30 +01:00
Dzmitry Lemechko 5e67ab3201 [coverage] change post stage 2021-11-09 21:41:39 +01:00
Dzmitry Lemechko 01e736904d [coverage] migrate ingestion scripts to buildkite 2021-11-09 21:25:41 +01:00
Dzmitry Lemechko 6807a40ada [coverage] migrate test scripts to buildkite 2021-11-08 18:15:58 +01:00
9 changed files with 254 additions and 1 deletions

View file

@ -0,0 +1,60 @@
env:
CODE_COVERAGE: '1'
NODE_ENV: 'test'
steps:
- command: .buildkite/scripts/lifecycle/pre_build.sh
label: Pre-Build
timeout_in_minutes: 10
- wait
- command: .buildkite/scripts/steps/build_kibana.sh
label: Build Kibana Distribution and Plugins
agents:
queue: c2-16
key: build
if: "build.env('KIBANA_BUILD_ID') == null || build.env('KIBANA_BUILD_ID') == ''"
timeout_in_minutes: 60
- command: .buildkite/scripts/steps/code_coverage/xpack_cigroup.sh
label: 'Default CI Group'
parallelism: 13
agents:
queue: ci-group-6
depends_on: build
timeout_in_minutes: 250
key: default-cigroup
retry:
automatic:
- exit_status: '*'
limit: 1
- command: .buildkite/scripts/steps/code_coverage/oss_cigroup.sh
label: 'OSS CI Group'
parallelism: 11
agents:
queue: ci-group-4d
depends_on: build
timeout_in_minutes: 120
key: oss-cigroup
retry:
automatic:
- exit_status: '*'
limit: 1
- command: .buildkite/scripts/steps/code_coverage/jest.sh
label: 'Jest Tests'
agents:
queue: c2-16
timeout_in_minutes: 150
key: jest
- wait: ~
continue_on_failure: true
- command: .buildkite/scripts/steps/code_coverage/ingest.sh
label: Post-Build
agents:
queue: c2-16
timeout_in_minutes: 120
key: jest

View file

@ -10,7 +10,6 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
echo "--- Upload Artifacts"
buildkite-agent artifact upload 'target/junit/**/*'
buildkite-agent artifact upload 'target/kibana-*'
buildkite-agent artifact upload 'target/kibana-coverage/jest/**/*'
buildkite-agent artifact upload 'target/kibana-security-solution/**/*.png'
buildkite-agent artifact upload 'target/test-metrics/*'
buildkite-agent artifact upload 'target/test-suites-ci-plan.json'
@ -25,6 +24,13 @@ if [[ "$IS_TEST_EXECUTION_STEP" == "true" ]]; then
buildkite-agent artifact upload 'x-pack/test/functional/failure_debug/html/*.html'
buildkite-agent artifact upload '.es/**/*.hprof'
if [[ "$CODE_COVERAGE" == "1" ]]; then
sh 'tar -czf kibana-coverage.tar.gz target/kibana-coverage/**/*'
buildkite-agent artifact upload 'kibana-coverage.tar.gz'
else
buildkite-agent artifact upload 'target/kibana-coverage/jest/**/*'
fi
echo "--- Run Failed Test Reporter"
node scripts/report_failed_tests --build-url="${BUILDKITE_BUILD_URL}#${BUILDKITE_JOB_ID}" 'target/junit/**/*.xml'

View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/common/util.sh
is_test_execution_step
.buildkite/scripts/bootstrap.sh
# download coverage arctifacts
buildkite-agent artifact download kibana-default.tar.gz . --build "${KIBANA_BUILD_ID:-$BUILDKITE_BUILD_ID}"
# process HTML Links
.buildkite/scripts/steps/code_coverage/ingest/prokLinks.sh
# collect VCS Info
.buildkite/scripts/steps/code_coverage/ingest/collectVcsInfo.sh
# merge coverage reports
. src/dev/code_coverage/shell_scripts/extract_archives.sh
. src/dev/code_coverage/shell_scripts/merge_functional.sh
. src/dev/code_coverage/shell_scripts/copy_jest_report.sh
# zip functional combined report
tar -czf kibana-functional-coverage.tar.gz target/kibana-coverage/functional-combined/*
ls -laR target/kibana-coverage/
buildkite-agent artifact upload 'kibana-functional-coverage.tar.gz'
# upload coverage static site
#.buildkite/scripts/steps/code_coverage/ingest/uploadStaticSite.sh
#ingest results to Kibana stats cluster
#. src/dev/code_coverage/shell_scripts/generate_team_assignments_and_ingest_coverage.sh '${jobName}' ${buildNum} '${buildUrl}' '${previousSha}' '${teamAssignmentsPath}'

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
echo "### Prok'd Index File: ..."
cat src/dev/code_coverage/www/index.html
predicate() {
x=$1
if [ -n "$x" ]; then
return
else
echo "### 1 or more variables that Code Coverage needs, are undefined"
exit 1
fi
}
CMD="git log --pretty=format"
XS=("${GIT_BRANCH}" \
"$(${CMD}":%h" -1)" \
"$(${CMD}":%an" -1)" \
"$(${CMD}":%s" -1)")
touch VCS_INFO.txt
for X in "${!XS[@]}"; do
{
predicate "${XS[X]}"
echo "${XS[X]}" >> VCS_INFO.txt
}
done
echo "### VCS_INFO:"
cat VCS_INFO.txt

View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
cat << EOF > src/dev/code_coverage/www/index_partial_2.html
<a class="nav-link" href="https://kibana-coverage.elastic.dev/${TIME_STAMP}/jest-combined/index.html">Latest Jest</a>
<a class="nav-link" href="https://kibana-coverage.elastic.dev/${TIME_STAMP}/functional-combined/index.html">Latest FTR</a>
</nav>
</div>
</header>
<main role="main" class="inner cover">
<!-- <h1 class="cover-heading"> - Master Branch</h1>-->
<p class="lead">Use Kibana Stats to mine coverage data</p>
<p class="lead">
<a href="https://kibana-stats.elastic.dev/app/kibana#/dashboard/58b8db70-62f9-11ea-8312-7f2d69b79843?_g=(filters%3A!()%2CrefreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-7d%2Cto%3Anow))" class="btn btn-lg btn-primary">Dashboard</a>
</p>
</main>
<footer class="mastfoot mt-auto">
<div class="inner">
<p>Please slack us at <a href="https://app.slack.com/client/T0CUZ52US/C0TR0FAET">#kibana-qa</a> if youve questions</p>
</div>
</footer>
</div>
</body>
</html>
EOF
cat src/dev/code_coverage/www/index_partial.html > src/dev/code_coverage/www/index.html
cat src/dev/code_coverage/www/index_partial_2.html >> src/dev/code_coverage/www/index.html

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
# def uploadPrefix = "gs://elastic-bekitzur-kibana-coverage-live/"
# def uploadPrefixWithTimeStamp = "${uploadPrefix}${timestamp}/"
# [
# 'src/dev/code_coverage/www/index.html',
# 'src/dev/code_coverage/www/404.html'
# ].each { uploadWithVault(uploadPrefix, it) }
# [
# 'target/kibana-coverage/functional-combined',
# 'target/kibana-coverage/jest-combined',
# ].each { uploadWithVault(uploadPrefixWithTimeStamp, it) }

View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/common/util.sh
is_test_execution_step
.buildkite/scripts/bootstrap.sh
echo '--- Jest with coverage'
node --max-old-space-size=6144 scripts/jest --ci --maxWorkers=10 --coverage || true
echo '--- Jest Integration Tests with coverage'
node --max-old-space-size=5120 scripts/jest_integration --ci --coverage || true
echo "--- Combine code coverage in a single report"
yarn nyc report --nycrc-path src/dev/code_coverage/nyc_config/nyc.jest.config.js

View file

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/steps/functional/common.sh
export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))}
export JOB=kibana-oss-ciGroup${CI_GROUP}
echo "--- OSS CI Group $CI_GROUP"
echo " -> Running Functional tests with code coverage"
export NODE_OPTIONS=--max_old_space_size=8192
echo " -> making hard link clones"
cd ..
cp -RlP kibana "kibana${CI_GROUP}"
cd "kibana${CI_GROUP}"
echo " -> running tests from the clone folder"
node scripts/functional_tests \
--include-tag "ciGroup$CI_GROUP" \
--exclude-tag "skipCoverage" || true
echo " -> moving junit output, silently fail in case of no report"
mkdir -p ../kibana/target/junit
mv target/junit/* ../kibana/target/junit/ || echo "copying junit failed"
echo " -> copying screenshots and html for failures"
cp -r test/functional/screenshots/* ../kibana/test/functional/screenshots/ || echo "copying screenshots failed"
cp -r test/functional/failure_debug ../kibana/test/functional/ || echo "copying html failed"

View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
set -euo pipefail
source .buildkite/scripts/steps/functional/common.sh
export CI_GROUP=${CI_GROUP:-$((BUILDKITE_PARALLEL_JOB+1))}
export JOB=kibana-default-ciGroup${CI_GROUP}
echo "--- Default CI Group $CI_GROUP"
echo " -> Running X-Pack functional tests with code coverage"
export NODE_OPTIONS=--max_old_space_size=8192
echo " -> making hard link clones"
cd ..
cp -RlP kibana "kibana${CI_GROUP}"
cd "kibana${CI_GROUP}/x-pack"
echo " -> running tests from the clone folder"
node scripts/functional_tests \
--include-tag "ciGroup$CI_GROUP" \
--exclude-tag "skipCoverage" || true
echo " -> moving junit output, silently fail in case of no report"
mkdir -p ../../kibana/target/junit
mv ../target/junit/* ../../kibana/target/junit/ || echo "copying junit failed"
echo " -> copying screenshots and html for failures"
cp -r test/functional/screenshots/* ../../kibana/x-pack/test/functional/screenshots/ || echo "copying screenshots failed"
cp -r test/functional/failure_debug ../../kibana/x-pack/test/functional/ || echo "copying html failed"
cd "$KIBANA_DIR"