Last active
October 2, 2019 21:31
-
-
Save alexcasalboni/6c5a630f53505ee0c6e3adcdfe5bd02c to your computer and use it in GitHub Desktop.
AWS CodeDeploy - Lambda hook (Node.js)
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
const AWS = require('aws-sdk'); | |
const codedeploy = new AWS.CodeDeploy(); | |
exports.handler = async (event, context) => { | |
const {DeploymentId, LifecycleEventHookExecutionId} = event; | |
const functionToTest = process.env.NewVersion; // to be defined in CFN | |
/* Enter validation tests here */ | |
const status = 'Succeeded'; // 'Succeeded' or 'Failed' | |
// Pass AWS CodeDeploy the prepared validation test results. | |
return await codedeploy.putLifecycleEventHookExecutionStatus({ | |
deploymentId: DeploymentId, | |
lifecycleEventHookExecutionId: LifecycleEventHookExecutionId, | |
status: status | |
}).promise(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment