Skip to content

Commit

Permalink
Fix code coverage for jest, upload merged reports (#68149)
Browse files Browse the repository at this point in the history
* replace path in json files

* upload combined reports to artifacts for debug purpose
  • Loading branch information
dmlemeshko authored Jun 3, 2020
1 parent b3e7ab3 commit 77abbf2
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .ci/Jenkinsfile_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def handleIngestion(timestamp) {
kibanaPipeline.downloadCoverageArtifacts()
kibanaCoverage.prokLinks("### Process HTML Links")
kibanaCoverage.collectVcsInfo("### Collect VCS Info")
kibanaCoverage.generateReports("### Merge coverage reports")
kibanaCoverage.uploadCombinedReports()
kibanaCoverage.ingest(timestamp, '### Injest && Upload')
kibanaCoverage.uploadCoverageStaticSite(timestamp)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ COMBINED_EXRACT_DIR=/${EXTRACT_START_DIR}/${EXTRACT_END_DIR}
PWD=$(pwd)
du -sh $COMBINED_EXRACT_DIR

echo "### Replacing path in json files"
echo "### Jest: replacing path in json files"
for i in coverage-final xpack-coverage-final; do
sed -i "s|/dev/shm/workspace/kibana|${PWD}|g" $COMBINED_EXRACT_DIR/jest/${i}.json &
done
wait

echo "### Functional: replacing path in json files"
for i in {1..9}; do
sed -i "s|/dev/shm/workspace/kibana|${PWD}|g" $COMBINED_EXRACT_DIR/functional/${i}*.json &
done
Expand Down
26 changes: 24 additions & 2 deletions vars/kibanaCoverage.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def collectVcsInfo(title) {
)
}

def bootMergeAndIngest(buildNum, buildUrl, title) {
def generateReports(title) {
kibanaPipeline.bash("""
source src/dev/ci_setup/setup_env.sh
# bootstrap from x-pack folder
Expand All @@ -108,6 +108,28 @@ def bootMergeAndIngest(buildNum, buildUrl, title) {
. src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh
. src/dev/code_coverage/shell_scripts/merge_jest_and_functional.sh
. src/dev/code_coverage/shell_scripts/copy_mocha_reports.sh
# zip combined reports
tar -czf kibana-coverage.tar.gz target/kibana-coverage/**/*
""", title)
}

def uploadCombinedReports() {
kibanaPipeline.bash("""
ls -laR target/kibana-coverage/
""", "### List Combined Reports"
)

kibanaPipeline.uploadGcsArtifact(
"kibana-ci-artifacts/jobs/${env.JOB_NAME}/${BUILD_NUMBER}/coverage/combined",
'kibana-coverage.tar.gz'
)
}

def ingestData(buildNum, buildUrl, title) {
kibanaPipeline.bash("""
source src/dev/ci_setup/setup_env.sh
yarn kbn bootstrap --prefer-offline
# Using existing target/kibana-coverage folder
. src/dev/code_coverage/shell_scripts/ingest_coverage.sh ${buildNum} ${buildUrl}
""", title)
}
Expand All @@ -117,7 +139,7 @@ def ingestWithVault(buildNum, buildUrl, title) {
withVaultSecret(secret: vaultSecret, secret_field: 'host', variable_name: 'HOST_FROM_VAULT') {
withVaultSecret(secret: vaultSecret, secret_field: 'username', variable_name: 'USER_FROM_VAULT') {
withVaultSecret(secret: vaultSecret, secret_field: 'password', variable_name: 'PASS_FROM_VAULT') {
bootMergeAndIngest(buildNum, buildUrl, title)
ingestData(buildNum, buildUrl, title)
}
}
}
Expand Down

0 comments on commit 77abbf2

Please sign in to comment.