Don't rely on stdout/stderr output
It seems that curl cannot reliably consume all the stdout / stderr
because of caching issues. We cannot reliably rely on it
for deciding the build success or failure.
Change-Id: Ifdb5c713b0c1b1a54dd6efb56c270c295ddad605
diff --git a/jenkins/gerrit-verifier-change.groovy b/jenkins/gerrit-verifier-change.groovy
index f8a5e36..79b7f63 100644
--- a/jenkins/gerrit-verifier-change.groovy
+++ b/jenkins/gerrit-verifier-change.groovy
@@ -48,9 +48,7 @@
def gerritPost(url, jsonPayload) {
def error = ""
def gerritPostUrl = Globals.gerrit + url
- def curl = ['curl', '--silent',
- '--output', '/dev/stderr',
- '--write-out', '%{http_code}',
+ def curl = ['curl',
'-n', '-s', '-S',
'-X', 'POST', '-H', 'Content-Type: application/json',
'--data-binary', jsonPayload,
@@ -66,15 +64,12 @@
println error
throw new IOException(error)
}
- def httpStatus = sout.toString().trim()
- if(httpStatus != "200") {
- error = "$curl **FAILED** with HTTP STATUS = $httpStatus"
- println error
- throw new IOException(error)
- }
+ if(!sout.toString().trim().isEmpty() && verbose) {
+ println "CURL/OUTPUT> $sout"
+ }
if(!serr.toString().trim().isEmpty() && verbose) {
- println "CURL/OUTPUT> $serr"
+ println "CURL/ERROR> $serr"
}
return 0