Skip to main content

Setting up Pipeline webhooks for AWS CodeCommit

How to set up your Pipeline with webhooks, to deploy changes made to a branch

Chris Mead avatar
Written by Chris Mead
Updated this week

This document is a guide to setting up a webhook for Pipelines in Gearset, that deploys changes from an AWS CodeCommit repository when the source branch changes.

Prerequisites before setting up CodeCommit webhooks:

  • You have added a repository connection for AWS CodeCommit (see our guide on Integrating with AWS CodeCommit).

  • The AWS CodeCommit repository you are connecting to is not blank and that there is at least one branch (e.g. Main) to work with; otherwise, you will get an error when creating your Gearset pipeline

  • You have followed our documentation for creating CI job webhooks for AWS CodeCommit

For Pipelines you will need:

  • 1 SNS Topic and Subscription

  • 1 Eventbridge Rule

  • 1 Trigger

Creating a Pipeline webhook for CodeCommit

When configuring a Gearset Pipeline using AWS CodeCommit, you will be asked to add a specific SNS Topic, Subscription & EventBridge Rule to allow all the Pipeline functionality to work as expected.

If you haven't yet created a pipeline, see our documentation on creating a pipeline using the pipeline setup wizard.

  1. Head to the Pipeline page, and click on the Settings cog, followed by Add webhook...

  2. This will bring up an informational modal explaining how to add in the SNS Topic, Subscription and EventBridge rule for your pipeline.

  3. Note down your Payload URL and Shared secret, and proceed with the following steps to add your webhook.

Adding a Webhook

  1. In the AWS Management Console, go to the Amazon SNS section and search Simple Notification Service.

  2. Create a new topic, then create a new subscription for that topic.

  3. Choose a name for your topic, and set its type as standard.

  4. Set Protocol to HTTPS.

  5. Set the Endpoint to the Payload URL you have saved from Gearset’s webhook setup dialog earlier.

  6. The new subscription’s ID will be Pending confirmation.

  7. Click Request confirmations and hit refresh in the table. The subscription should then be assigned a proper subscription ID.

  8. In the AWS Management Console, go to AWS CodeCommit.

  9. For the repository you’re deploying, go to Settings, and then to Triggers.

  10. Click Create new trigger.

  11. Under Events, select Push to existing branch.

  12. Do not select any branches under Brach names so the webhook works for all branches in your pipeline.

  13. Select the SNS topic you created earlier.

  14. Under Custom data, paste in the Shared secret from Gearset’s webhook setup dialog earlier.

You can click Test trigger to confirm it can connect successfully. The next time you push to this branch, it will trigger the CI job in Gearset.

Setting up an EventBridge rule

Your pipeline webhook will need an EventBridge rule to function correctly. After you've created your Pipeline webhook, please refer to our guide on EventBridge configuration for AWS CodeCommit.

Did this answer your question?