This is an automated email from the ASF dual-hosted git repository.
marcoabreu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 1045140 Correct PR branch detection in code coverage (#12615)
1045140 is described below
commit 10451400fb0572bd948e227b63bd36d5b84288fc
Author: Marco de Abreu <[email protected]>
AuthorDate: Fri Sep 21 14:10:16 2018 +0200
Correct PR branch detection in code coverage (#12615)
* Correct PR branch detection in code coverage
* Always use latest commit
* Add merge commit detection
* Add debug output
* Remove debug output
---
ci/Jenkinsfile_utils.groovy | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy
index ca5f234..818eb62 100644
--- a/ci/Jenkinsfile_utils.groovy
+++ b/ci/Jenkinsfile_utils.groovy
@@ -77,17 +77,23 @@ 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
+ lastCommitMessage = sh (script: "git log -1 --pretty=%B", returnStdout:
true)
+ lastCommitMessage = lastCommitMessage.trim()
+ if (lastCommitMessage.startsWith("Merge commit '") &&
lastCommitMessage.endsWith("' into HEAD")) {
+ // Merge commit applied by Jenkins, skip that commit
+ GIT_COMMIT_HASH = sh (script: "git rev-parse @~", returnStdout: true)
+ } else {
+ GIT_COMMIT_HASH = sh (script: "git rev-parse @", returnStdout: true)
+ }
+
def codecovArgs = ""
- if (env.CHANGE_ID != '') {
+ 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} "
}