bigtop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From evan...@apache.org
Subject [bigtop] branch master updated: BIGTOP-3148. Error out when configure-nexus encounter any issue (#456)
Date Tue, 29 Jan 2019 08:41:18 GMT
This is an automated email from the ASF dual-hosted git repository.

evansye pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bigtop.git


The following commit(s) were added to refs/heads/master by this push:
     new f62bf0c  BIGTOP-3148. Error out when configure-nexus encounter any issue (#456)
f62bf0c is described below

commit f62bf0c5a3eb5d840361127ea9399c0661e2fa6e
Author: Evans Ye <evansye@apache.org>
AuthorDate: Tue Jan 29 16:41:13 2019 +0800

    BIGTOP-3148. Error out when configure-nexus encounter any issue (#456)
---
 build.gradle | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index be1efe8..a925be0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -373,8 +373,25 @@ def generate_nexus_tasks = { name, url, snapshot ->
       write root.toString()
 
       workingDir '.'
-      commandLine  "curl", "-o", "/dev/null", "-X", "POST", "-d", "@$absolutePath",
+      commandLine  "curl", "-o", "/dev/null", "-s", "-w", "%{http_code}", "-X", "POST", "-d",
"@$absolutePath",
         "--header", "Content-Type: application/json", "-u", "$_NEXUS_USERPASS", "$_NEXUS_URL/service/local/repositories"
+      standardOutput = new ByteArrayOutputStream()
+
+      doLast {
+        def httpCode = standardOutput.toString()
+        switch (httpCode) {
+          case "200":
+            println "Nexus proxy ${name} successfully configured"
+            break
+          case "400":
+            println "Skipped because Nexus proxy ${name} already configured"
+            break
+          default:
+            throw new GradleException("Failed to configure Nexus proxy ${name} with http
code ${httpCode} returned. " +
+             "Run with --info option to see the executed command")
+            break
+        }
+      }
     }
   }
 }


Mime
View raw message