Skip to content

Instantly share code, notes, and snippets.

@ojhughes
Created August 24, 2018 15:25
Show Gist options
  • Save ojhughes/946788627e8a69c16b4b51cdd994dd15 to your computer and use it in GitHub Desktop.
Save ojhughes/946788627e8a69c16b4b51cdd994dd15 to your computer and use it in GitHub Desktop.
@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