Skip to main content
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 yesterday

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 a new EventBridge Rule.

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

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

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

    1. Navigate to the ‘Creation method’ section on the same page:

    2. Choose the Method as Use pattern form.

    3. Under ‘Event Pattern’, select the following dropdown options:

      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. 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 each set of settings as their default.

  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?