diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy index dfa2519bd0e5..571c0b952e3d 100644 --- a/ci/Jenkinsfile_utils.groovy +++ b/ci/Jenkinsfile_utils.groovy @@ -75,8 +75,25 @@ echo ${libs} | sed -e 's/,/ /g' | xargs md5sum } def publish_test_coverage() { + // CodeCovs auto detection has trouble with our CIs PR validation due the merging strategy + def codecovArgs = "" + if (env.CHANGE_ID != '') { + // PR execution + // Take the previous commit because of our PR merge strategy that adds a temporary commit for CI + GIT_COMMIT_HASH = sh (script: "git rev-parse @~", returnStdout: true) + codecovArgs += "-B ${env.CHANGE_TARGET} " + + "-C ${GIT_COMMIT_HASH} " + + "-P ${env.CHANGE_ID} " + } else { + // Branch execution + GIT_COMMIT_HASH = sh (script: "git rev-parse @", returnStdout: true) + codecovArgs += "-B ${env.BRANCH_NAME} " + + "-C ${GIT_COMMIT_HASH} " + } + + // To make sure we never fail because test coverage reporting is not available // Fall back to our own copy of the bash helper if it failed to download the public version - sh '(curl --retry 10 -s https://codecov.io/bash | bash -s -) || (curl --retry 10 -s https://s3-us-west-2.amazonaws.com/mxnet-ci-prod-slave-data/codecov-bash.txt | bash -s -)' + sh "(curl --retry 10 -s https://codecov.io/bash | bash -s - ${codecovArgs}) || (curl --retry 10 -s https://s3-us-west-2.amazonaws.com/mxnet-ci-prod-slave-data/codecov-bash.txt | bash -s - ${codecovArgs}) || true" } def collect_test_results_unix(original_file_name, new_file_name) {