Skip to content

Commit

Permalink
Fix CodeCovs proper commit detection (apache#12551)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoabreu authored and anirudh2290 committed Sep 19, 2018
1 parent 2339571 commit 315c4dd
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion ci/Jenkinsfile_utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 315c4dd

Please sign in to comment.