com.amazonaws.services.codedeploy.AmazonCodeDeploy Java Examples
The following examples show how to use
com.amazonaws.services.codedeploy.AmazonCodeDeploy.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WaitDeployStep.java From pipeline-aws-plugin with Apache License 2.0 | 5 votes |
@Override protected Void run() throws Exception { TaskListener listener = this.getContext().get(TaskListener.class); AmazonCodeDeploy client = AWSClientFactory.create(AmazonCodeDeployClientBuilder.standard(), this.getContext()); listener.getLogger().format("Checking Deployment(%s) status", this.deploymentId); while (true) { GetDeploymentRequest getDeploymentRequest = new GetDeploymentRequest().withDeploymentId(this.deploymentId); GetDeploymentResult deployment = client.getDeployment(getDeploymentRequest); String deploymentStatus = deployment.getDeploymentInfo().getStatus(); listener.getLogger().format("DeploymentStatus(%s)", deploymentStatus); if (SUCCEEDED_STATUS.equals(deploymentStatus)) { listener.getLogger().println("Deployment completed successfully"); return null; } else if (FAILED_STATUS.equals(deploymentStatus)) { listener.getLogger().println("Deployment completed in error"); String errorMessage = deployment.getDeploymentInfo().getErrorInformation().getMessage(); throw new Exception("Deployment Failed: " + errorMessage); } else if (STOPPED_STATUS.equals(deploymentStatus)) { listener.getLogger().println("Deployment was stopped"); throw new Exception("Deployment was stopped"); } else { listener.getLogger().println("Deployment still in progress... sleeping"); try { Thread.sleep(POLLING_INTERVAL); } catch (InterruptedException e) { // } } } }
Example #2
Source File: CodeDeployUtils.java From herd-mdl with Apache License 2.0 | 4 votes |
/** * Waits for a given deployment to succeed (or fail). * * @param deploymentId: String. The specified deployment's id. */ public static void waitForMostRecentDeployment(String deploymentId) { LOGGER.debug("Waiting on deployment with id: \'{}\'", deploymentId); AmazonCodeDeploy codeDeployClient = AmazonCodeDeployClientBuilder.standard() .withRegion(Regions.US_EAST_1).build(); GetDeploymentRequest getDeploymentRequest = new GetDeploymentRequest(); getDeploymentRequest.setDeploymentId(deploymentId); Waiter<GetDeploymentRequest> waiter = codeDeployClient.waiters().deploymentSuccessful(); try { waiter.run(new WaiterParameters<>(getDeploymentRequest)); LOGGER.info("Deployment was successful."); } catch (WaiterUnrecoverableException | WaiterTimedOutException e) { LOGGER.error("Deployment with id: {} was unsuccessful.", deploymentId); } }
Example #3
Source File: MvcConfiguration.java From aws-codedeploy-sample-tomcat with Apache License 2.0 | 4 votes |
@Bean public AmazonCodeDeploy codeDeploy() { final AmazonCodeDeploy client = new AmazonCodeDeployClient(); client.setRegion(region); return client; }