Skip to content

Commit 71523ea

Browse files
Merge pull request #159 from apigee/Issue158
Fix for #158
2 parents 1415164 + 8ac272e commit 71523ea

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

samples/mockapi-recommended/src/gateway/shared-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<plugin>
7474
<groupId>io.apigee.build-tools.enterprise4g</groupId>
7575
<artifactId>apigee-edge-maven-plugin</artifactId>
76-
<version>2.1.0</version>
76+
<version>2.1.1</version>
7777
<executions>
7878
<execution>
7979
<id>configure-bundle</id>

samples/security-sharedflow/src/sharedflows/parent-sharedflow-pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<plugin>
7474
<groupId>io.apigee.build-tools.enterprise4g</groupId>
7575
<artifactId>apigee-edge-maven-plugin</artifactId>
76-
<version>2.1.0</version>
76+
<version>2.1.1</version>
7777
<executions>
7878
<execution>
7979
<id>configure-bundle</id>

src/main/java/io/apigee/buildTools/enterprise4g/rest/RestUtil.java

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
import java.io.File;
1919
import java.io.IOException;
20-
import java.util.ArrayList;
2120
import java.util.Collections;
2221
import java.util.Iterator;
2322
import java.util.List;
23+
import java.util.stream.Collectors;
2424

2525
import javax.net.ssl.HttpsURLConnection;
2626

@@ -207,6 +207,8 @@ public static class DeploymentStatus {
207207
@Key
208208
public List<PodStatus> pods;
209209
@Key
210+
public List<Error> errors;
211+
@Key
210212
public String organization;
211213
}
212214

@@ -230,6 +232,22 @@ public static class PodStatus {
230232
@Key
231233
public String statusCodeDetails;
232234
}
235+
236+
public static class Error {
237+
@Key
238+
public Integer code;
239+
@Key
240+
public String message;
241+
242+
public String getMessage() {
243+
return message;
244+
}
245+
246+
public void setMessage(String message) {
247+
this.message = message;
248+
}
249+
250+
}
233251

234252
public static class AppConfig {
235253
@Key
@@ -418,24 +436,24 @@ public static boolean getDeploymentStateForRevision(ServerProfile profile, Strin
418436
restRequest.setHeaders(headers);
419437
HttpResponse response = executeAPI(profile, restRequest);
420438
deploymentStatus = response.parseAs(DeploymentStatus.class);
421-
/*if(deploymentStatus!=null && deploymentStatus.pods!=null && deploymentStatus.pods.size()>0) {
422-
for (PodStatus p: deploymentStatus.pods) {
423-
if(p.deploymentStatus!=null && p.deploymentStatus.equals("deployed")) {
424-
deployed = true;
425-
}else {
426-
deployed = false;
427-
break;
428-
}
429-
430-
}
431-
}*/
432-
if(deploymentStatus!=null && deploymentStatus.state != null && deploymentStatus.state.equalsIgnoreCase("READY")) {
439+
//For https://github.com/apigee/apigee-deploy-maven-plugin/issues/158
440+
if(deploymentStatus!=null && deploymentStatus.state != null && deploymentStatus.state.equalsIgnoreCase("ERROR")) {
441+
if(deploymentStatus.errors!=null && deploymentStatus.errors.size()>0) {
442+
String errorString = deploymentStatus.errors.stream().map(Error::getMessage)
443+
.collect(Collectors.joining("\n"));
444+
throw new IOException("Deployment error: "+errorString);
445+
}
446+
}
447+
else if(deploymentStatus!=null && deploymentStatus.state != null && deploymentStatus.state.equalsIgnoreCase("READY")) {
433448
deployed = true;
434449
}else {
435450
deployed = false;
436451
}
437452
}catch (HttpResponseException e) {
438453
logger.error(e.getMessage());
454+
} catch (IOException e) {
455+
logger.error(e.getMessage());
456+
throw e;
439457
} catch (Exception e) {
440458
logger.error(e.getMessage());
441459
}

0 commit comments

Comments
 (0)