From 16cdc9f88b0a3119a4ad6679fc5021326e16ce72 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 3 Jun 2020 18:03:54 +0200 Subject: [PATCH 1/2] replace path in json files --- .../shell_scripts/fix_html_reports_parallel.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh b/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh index bc184301a6831..098737eb2f800 100644 --- a/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh +++ b/src/dev/code_coverage/shell_scripts/fix_html_reports_parallel.sh @@ -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 From 0861bface1d68be494314ce31eaef0f7f16bcd5b Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Wed, 3 Jun 2020 20:11:06 +0200 Subject: [PATCH 2/2] upload combined reports to artifacts for debug purpose --- .ci/Jenkinsfile_coverage | 2 ++ vars/kibanaCoverage.groovy | 26 ++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.ci/Jenkinsfile_coverage b/.ci/Jenkinsfile_coverage index 63798e2e29e44..3f4732f15f334 100644 --- a/.ci/Jenkinsfile_coverage +++ b/.ci/Jenkinsfile_coverage @@ -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) } diff --git a/vars/kibanaCoverage.groovy b/vars/kibanaCoverage.groovy index 6ef8f6fc64cd5..0305f86475a9a 100644 --- a/vars/kibanaCoverage.groovy +++ b/vars/kibanaCoverage.groovy @@ -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 @@ -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) } @@ -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) } } }