Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code coverage for jest, upload merged reports #68149

Merged
merged 2 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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