All Collections
Feature guides
Automation and CI
Continuous integration
EventBridge configuration for the users using AWS CodeCommit
EventBridge configuration for the users using AWS CodeCommit

Additional configuration required for triggering CI validation upon creation of pull request for the users using AWS CodeCommit.

Amrutraj Patil avatar
Written by Amrutraj Patil
Updated over a week ago

Once the connection to your AWS CodeCommit is made from Gearset and CI job webhook set-up is configured correctly by following this document, we would now look at few more steps for the webhook to trigger a CI job when a new pull request (PR) is raised against the branch a CI job is tracking and not just when the PR is merged/pushed. This gives us forward-looking validations against the target org as the PR opens, in line with the 'Validate pull requests targeting the source branch' option in Gearset CI jobs.

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

This can be found under:

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

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

Copy and keep it handy for a future step.

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

  2. Open Amazon EventBridge service by clicking on it.

  3. Create new EventBridge rule.

  4. Enter event rule name and select ‘Rule with an event pattern’ option, click Next.

  5. In step 2 of ‘Build event pattern’ select Event source as ‘AWS events or EventBridge partner events

  6. Under ‘Creation method’ section on the same page:

    1. Choose Method = Use pattern form

    2. Under ‘Event Pattern’, set

    3. Event source = AWS services

    4. AWS service = CodeCommit

    5. Event type = CodeCommit Pull Request State Change

    6. Select Specific resource(s) by ARN

    7. Copy and paste your Repository ARN that you had noted in the beginning and click Next.

  7. On the Select target(s) page, select Target Type as ‘AWS service

  8. Under Select a target, choose ‘SNS topic’

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

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

  10. Click ‘Next’ and 'Next' again, leaving the defaults

  11. 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

Just to ensure that you have the CodeCommit trigger setup right as per this document, check if your configuration is similar to the below.

This should complete the whole setup process for the trigger to work upon creation of pull requests in AWS CodeCommit, and the Gearset CI job to start child validation jobs. Test this configuration by creating new pull request to the branch that CI job is associated with, and ensuring the validation job appears in the Continuous Integration dashboard as below.

Still need some help? Contact our team and we'll be happy to assist. See how.

Let me know if this helped with your reaction below!

Did this answer your question?