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:
Firstly, on your AWS console,
search
forEventBridge
.Click on the Amazon
EventBridge
service.Enter the event
<Rule Name>
and selectRule with an event pattern
option. Then clickNext
.In step 2 of βBuild event patternβ set
Event source
asAWS events or EventBridge partner events
.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:
Navigate to
Creation method
section on the same page.Set
Method
asUse pattern form
.Under
Event Pattern
, select the following options in the drop-down:Event source
=AWS services
.AWS service
=CodeCommit
.Event type
=CodeCommit Pull Request State Change
.
Select
Specific resource(s) by ARN
.
Go to the
Select target(s)
page, setTarget Type
asAWS service
.Under
Select a target
, chooseSNS topic
.Choose the name of the
Topic
you had created as part of initial CodeCommit webhook setup.Click
Next
,Next
, leaving each set of settings as their default.On the final step,
Review
the setup andSave
the configuration. Now, you can see newEvent rule
which you just created underEvents
>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.