Skip to main content

EventBridge configuration for AWS CodeCommit

Required configuration for triggering CI validation after PR creation for AWS CodeCommit integration

Nat Werth avatar
Written by Nat Werth
Updated today

Once AWS CodeCommit is connected to Gearset and your CI job, webhook set-up is configured correctly by following our guide on Getting started with AWS CodeCommit webhooks. Next, we will look at a few more steps to allow the webhook to trigger a CI job when a new PR is raised, in addition to when the PR is merged. This will create forward-looking validations against the target org when the PR is opened. This is line with the 'Validate pull requests targeting the source branch' option in your CI job settings.

Before you begin, you need your repository ARN from your existing configuration.

This can be found in CodeCommit under:

  • Repositories > <Repository Name> (e.g. gearset_demo) > Settings.

  • It will look something like arn:aws:codecommit:us-east-1:123725757452:SamCDemo.

Copy and keep <Repository ARN> handy for a future step. Once you have obtained your repo's ARN, you are ready to configure EventBridge to integrate with Gearset:

  1. Firstly, on your AWS console, search for EventBridge.

  2. Click on the Amazon EventBridge service.

    1. Select EventBridge Rule and click Create Rule.

  3. Enter the event <Rule Name> and select Rule with an event pattern option. Then click Next.

  4. In step 2 of β€˜Build event pattern’ set Event source as AWS events or EventBridge partner events.

  5. It is critical that only Pull Request events for the correct repository are sent. If misconfigured, Gearset may be sent other (or even all) AWS events. Carefully follow each step below to configure the event pattern:

    1. Navigate to Creation method section on the same page.

    2. Set Method as Use pattern form.

    3. Under Event Pattern, select the following options in the drop-down:

      1. Event source = AWS services.

      2. AWS service = CodeCommit.

      3. Event type = CodeCommit Pull Request State Change.

    4. Select Specific resource(s) by ARN.

      1. Paste your <Repository ARN> from earlier and click Next.

  6. Go to the Select target(s) page, set Target Type as AWS service.

  7. Under Select a target, choose SNS topic.

  8. Choose the name of the Topic you had created as part of initial CodeCommit webhook setup.

    1. In the following example, the Topic name selected is Webhook.l

  9. Click Next, Next, leaving each set of settings as their default.

  10. On the final step, Review the setup and Save the configuration. Now, you can see new Event rule which you just created under Events > Rules.

To ensure proper CodeCommit trigger configuration, double-check your setup looks like this:

This completes the setup process to allow newly-created PRs to trigger CI jobs and child validation jobs in Gearset using AWS CodeCommit. Test this configuration by creating a new PR to the branch that CI job is associated with, ensuring the validation job appears in Gearset's CI Dashboard:

Still need help? Contact our team, and we'll be happy to assist. See how to contact Gearset support.

Did this answer your question?