You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by ev...@apache.org on 2019/01/29 08:41:18 UTC

[bigtop] branch master updated: BIGTOP-3148. Error out when configure-nexus encounter any issue (#456)

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 <ev...@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
+        }
+      }
     }
   }
 }