Created
August 24, 2018 15:25
-
-
Save ojhughes/946788627e8a69c16b4b51cdd994dd15 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public Flux<DeploymentState> deploy(AppDeploymentRequest request) { | |
logger.trace("Entered deploy: Deploying AppDeploymentRequest: AppDefinition = {}, Resource = {}, Deployment Properties = {}", | |
request.getDefinition(), request.getResource(), request.getDeploymentProperties()); | |
String deploymentId = deploymentId(request); | |
logger.trace("deploy: Pushing application"); | |
return pushApplication(deploymentId, request) | |
.timeout(Duration.ofSeconds(this.deploymentProperties.getApiTimeout())) | |
.doOnError(error -> { | |
if (isNotFoundError().test(error)) { | |
logger.warn("Unable to deploy application. It may have been destroyed before start completed: " + error.getMessage()); | |
} | |
else { | |
logError(String.format("Failed to deploy %s", deploymentId)).accept(error); | |
} | |
}) | |
.then(getStatus(deploymentId)) | |
.repeat() | |
.map(AppStatus::getState) | |
.distinctUntilChanged() | |
.takeUntil(pred -> pred.equals(DeploymentState.deployed)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment