diff --git a/lib/uc-cloud-connect-java/cloud-connect-java/1.0.920563/cloud-connect-java-1.0.920563.pom b/lib/uc-cloud-connect-java/cloud-connect-java/1.0.920563/cloud-connect-java-1.0.920563.pom
index 706aa89..1882fbb 100644
--- a/lib/uc-cloud-connect-java/cloud-connect-java/1.0.920563/cloud-connect-java-1.0.920563.pom
+++ b/lib/uc-cloud-connect-java/cloud-connect-java/1.0.920563/cloud-connect-java-1.0.920563.pom
@@ -24,12 +24,6 @@
1.10
compile
-
- log4j
- log4j
- 1.2.17
- compile
-
junit
junit
diff --git a/pom.xml b/pom.xml
index 96b7d5a..172221f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
4.0.0
com.hcl.devops
hcl-accelerate
- 2.1.4
+ 2.1.5
hpi
HCL Accelerate Plugin
This plugin can run Jenkins jobs as a part of a deployment plan in HCL Accelerate.
@@ -167,7 +167,7 @@
org.apache.httpcomponents
httpclient
- 4.3.6
+ 4.5.13
com.google.code.gson
@@ -238,7 +238,7 @@
com.rabbitmq
amqp-client
- 5.2.0
+ 5.14.2
org.acegisecurity
diff --git a/src/main/java/com/hcl/devops/connect/CloudSocketComponent.java b/src/main/java/com/hcl/devops/connect/CloudSocketComponent.java
index 9a2b622..afda9a0 100644
--- a/src/main/java/com/hcl/devops/connect/CloudSocketComponent.java
+++ b/src/main/java/com/hcl/devops/connect/CloudSocketComponent.java
@@ -187,13 +187,14 @@ public void handleDelivery(String consumerTag, Envelope envelope,
String syncToken = getSyncToken();
String url = removeTrailingSlash(Jenkins.getInstance().getDescriptorByType(DevOpsGlobalConfiguration.class).getBaseUrl());
- boolean connected = CloudPublisher.testConnection(syncId, syncToken, url);
+ CloudPublisher.testConnection(syncId, syncToken, url);
} else {
String message = new String(body, "UTF-8");
String payload = null;
String syncToken = getSyncToken();
try {
payload = decrypt(syncToken, message.toString());
+ log.info("payload: " + payload);
} catch (Exception e) {
System.out.println("Unable to decrypt");
}
@@ -206,69 +207,78 @@ public void handleDelivery(String consumerTag, Envelope envelope,
String encodedString = getEncodedString(plainCredentials);
String authorizationHeader = "Basic " + encodedString;
String rootUrl = Jenkins.getInstance().getRootUrl();
+ log.info("Root Url: " + rootUrl);
String path = "job/"+jobName.replaceAll("/", "/job/")+"/api/json";
+ log.info("Path: " + path);
String finalUrl = null;
String buildDetails = null;
try {
URIBuilder builder = new URIBuilder(rootUrl);
builder.setPath(builder.getPath()+path);
- builder.setQuery("fetchAllbuildDetails=True");
+ builder.setParameter("fetchAllbuildDetails", "True");
finalUrl = builder.toString();
+ log.info("Final Url: " + finalUrl);
} catch (Exception e) {
- log.error("Caught error while building url to get details of previous builds: ", e);
+ log.warn("Caught error while building url to get details of previous builds: ", e);
}
try {
HttpResponse response = Unirest.get(finalUrl)
.header("Authorization", authorizationHeader)
.asString();
buildDetails = response.getBody().toString();
+ log.info("buildDetails Response: " + buildDetails);
} catch (UnirestException e) {
- log.error("UnirestException: Failed to get details of previous Builds", e);
+ log.warn("UnirestException: Failed to get details of previous Builds. Skipping duplicate check.");
+ System.out.println(" [x] Received '" + message + "'");
+ CloudWorkListener2 cloudWorkListener = new CloudWorkListener2();
+ cloudWorkListener.call("startJob", message);
}
- JSONArray buildDetailsArray = JSONArray.fromObject("[" + buildDetails + "]");
- JSONObject buildDetailsObject = buildDetailsArray.getJSONObject(0);
- if(buildDetailsObject.has("builds")){
- JSONArray builds = JSONArray.fromObject(buildDetailsObject.getString("builds"));
- int buildsCount = 0;
- if(builds.size()<50){
- buildsCount=builds.size();
- }
- else{
- buildsCount=50;
- }
- StringBuilder str = new StringBuilder();
- for(int i=0;i buildResponse = Unirest.get(finalBuildUrl)
- .header("Authorization", authorizationHeader)
- .asString();
- String buildConsole = buildResponse.getBody().toString();
- str.append(buildConsole);
- } catch (UnirestException e) {
- log.error("UnirestException: Failed to get console Logs of previous builds", e);
+ if (buildDetails != null) {
+ JSONArray buildDetailsArray = JSONArray.fromObject("[" + buildDetails + "]");
+ JSONObject buildDetailsObject = buildDetailsArray.getJSONObject(0);
+ if(buildDetailsObject.has("builds")){
+ JSONArray builds = JSONArray.fromObject(buildDetailsObject.getString("builds"));
+ int buildsCount = 0;
+ if(builds.size()<50){
+ buildsCount=builds.size();
+ }
+ else{
+ buildsCount=50;
+ }
+ StringBuilder str = new StringBuilder();
+ for(int i=0;i buildResponse = Unirest.get(finalBuildUrl)
+ .header("Authorization", authorizationHeader)
+ .asString();
+ String buildConsole = buildResponse.getBody().toString();
+ str.append(buildConsole);
+ } catch (UnirestException e) {
+ log.error("UnirestException: Failed to get console Logs of previous builds", e);
+ }
}
}
+ String allConsoleLogs = str.toString();
+ boolean isFound = allConsoleLogs.contains("Started due to a request from UrbanCode Velocity. Work Id: "+workId);
+ if(isFound==true){
+ log.info(" =========================== Found duplicate Jenkins Job and stopped it =========================== ");
+ }
+ else{
+ System.out.println(" [x] Received '" + message + "'");
+ CloudWorkListener2 cloudWorkListener = new CloudWorkListener2();
+ cloudWorkListener.call("startJob", message);
+ }
}
- String allConsoleLogs =str.toString();
- boolean isFound = allConsoleLogs.contains("Started due to a request from HCL Accelerate. Work Id: "+workId);
- if(isFound==true){
- log.info(" =========================== Found duplicate Jenkins Job and stopped it =========================== ");
- }
- else{
- System.out.println(" [x] Received '" + message + "'");
- CloudWorkListener2 cloudWorkListener = new CloudWorkListener2();
- cloudWorkListener.call("startJob", message);
- }
}
}
}
diff --git a/src/main/java/com/hcl/devops/connect/Status/AbstractJenkinsStatus.java b/src/main/java/com/hcl/devops/connect/Status/AbstractJenkinsStatus.java
index 53a0767..beae1bf 100644
--- a/src/main/java/com/hcl/devops/connect/Status/AbstractJenkinsStatus.java
+++ b/src/main/java/com/hcl/devops/connect/Status/AbstractJenkinsStatus.java
@@ -323,7 +323,7 @@ public JSONObject generate(boolean completed) {
}
}
} catch (UnirestException e) {
- log.error("UnirestException: Failed to get details of requestor", e);
+ log.warn("UnirestException: Failed to get details of requestor");
}
// log.info(result.toString());
return result;