diff --git a/src/main/java/com/hpe/cloudfoundryjenkins/CloudFoundryPushPublisher.java b/src/main/java/com/hpe/cloudfoundryjenkins/CloudFoundryPushPublisher.java index f790bc6..909b047 100644 --- a/src/main/java/com/hpe/cloudfoundryjenkins/CloudFoundryPushPublisher.java +++ b/src/main/java/com/hpe/cloudfoundryjenkins/CloudFoundryPushPublisher.java @@ -368,6 +368,9 @@ private boolean createApplicationIfNeeded(CloudFoundryClient client, BuildListen } } + Staging staging = new Staging(deploymentInfo.getCommand(), deploymentInfo.getBuildpack(), + deploymentInfo.getStack(), deploymentInfo.getTimeout()); + // Create app if it doesn't exist if (createNewApp) { listener.getLogger().println("Creating new app."); @@ -375,8 +378,6 @@ private boolean createApplicationIfNeeded(CloudFoundryClient client, BuildListen if (stack != null && client.getStack(stack) == null) { throw new IllegalArgumentException("Stack " + stack + " does not exist on the target."); } - Staging staging = new Staging(deploymentInfo.getCommand(), deploymentInfo.getBuildpack(), - deploymentInfo.getStack(), deploymentInfo.getTimeout()); List uris = new ArrayList(); // Pass an empty List as the uri list if no-route is set if (!deploymentInfo.isNoRoute()) { @@ -384,6 +385,8 @@ private boolean createApplicationIfNeeded(CloudFoundryClient client, BuildListen } List services = deploymentInfo.getServicesNames(); client.createApplication(deploymentInfo.getAppName(), staging, deploymentInfo.getMemory(), uris, services); + } else { + client.updateApplicationStaging(deploymentInfo.getAppName(), staging); } return createNewApp;