After you have set up your CI job/Pipeline webhooks, you'll need to create an EventBridge rule for them 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.
Note: If you are using Pipelines, you must create two EventBridge rules. One must point towards the Pipeline topic, and one must point towards the CI job topic.
β
If both of these are not set up, you may observe strange behaviour like Validations remaining after promotion in your CI job menu.
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,
searchforEventBridge.Click on the Amazon
EventBridgeservice.Enter the event
<Rule Name>and selectRule with an event patternoption. Then clickNext.In step 2 of βBuild event patternβ set
Event sourceasAWS 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 methodsection on the same page.Set
MethodasUse 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 TypeasAWS service.Under
Select a target, chooseSNS topic.Select the
Topicname created for your CI job or Pipeline webhook setup.Click
Next,Next, leaving each set of settings as their default.On the final step,
Reviewthe setup andSavethe configuration. Now, you can see newEvent rulewhich 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.

