A simple lambda function that gets triggerred in response to an AWS CodeCommit repository events and update the team in slack.
Follow this article in Youtube
-
We will need the following pre-requisites to successfully complete this activity,
AWS CodeCommit Repo
- Get help here to setup CodeCommit Repo- IAM Role - i.e
Lambda Service Role
- with managed permissions Get Help for setting up IAM RoleAWSLambdaBasicExecutionRole
- To allow Lambda to log eventsAWSCodeCommitReadOnly
- To allow Lambda to read repo metadata
-
- The python script is written(and tested) in
Python 3.7
. Copy
the code fromserverless-code-commit-repo-event-notifier
in this repo to the lambda function- Optional: Add slack
slack_webhook_url
in the environment variable Save
the lambda function
- The python script is written(and tested) in
-
- Choose AWS CodeCommit from the list of services.
-
In Repository name, choose your repository name.
-
In Trigger name, enter a name for the trigger.
-
In Events, choose the repository events that trigger the Lambda function, for example, choose All repository events.
-
In Branches, Choose All branches, if you want the trigger to apply to all branches of the repository.
-
In Custom data, Optional: Leave empty for now.
-
Choose Next.
Now your lambda function should be triggered when ever there is a CodeCommit event in your repository
-
Testing the solution
Create a new commit/branch in your repo, you should be getting the message in Slack(if configured).