marcoabreu closed pull request #12551: Add correct test coverage branch 
detection
URL: https://github.com/apache/incubator-mxnet/pull/12551
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ci/Jenkinsfile_utils.groovy b/ci/Jenkinsfile_utils.groovy
index dfa2519bd0e..571c0b952e3 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) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to