Skip to content

Commit

Permalink
cleanup preTrafficHook.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sullis committed May 2, 2019
1 parent 6912032 commit f664535
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports.handler = async (event, context, callback) => {

console.log("Entering PreTraffic Hook!");
console.log(JSON.stringify(event));

//Read the DeploymentId from the event payload.
let deploymentId = event.DeploymentId;
console.log("deploymentId=" + deploymentId);
Expand All @@ -20,23 +20,23 @@ exports.handler = async (event, context, callback) => {
/*
[Perform validation or prewarming steps here]
*/

// Prepare the validation test results with the deploymentId and
// the lifecycleEventHookExecutionId for AWS CodeDeploy.
let params = {
deploymentId: deploymentId,
lifecycleEventHookExecutionId: lifecycleEventHookExecutionId,
status: 'Succeeded' // status can be 'Succeeded' or 'Failed'
};

try {
await codedeploy.putLifecycleEventHookExecutionStatus(params).promise();
console.log("putLifecycleEventHookExecutionStatus done. executionStatus=[" + params.status + "]");
return 'Validation test succeeded'
}
catch (err) {
console.log("putLifecycleEventHookExecutionStatus ERROR: " + err);
return 'Validation test failed'
throw new Error('Validation test failed')
}

}
Expand Down

0 comments on commit f664535

Please sign in to comment.