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.
Firstly, on your AWS console, search for EventBridge
Open Amazon EventBridge service by clicking on it.
Create new EventBridge rule.
Enter event rule name and select ‘Rule with an event pattern’ option, click Next.
In step 2 of ‘Build event pattern’ select Event source as ‘AWS events or EventBridge partner events’
Under ‘Creation method’ section on the same page:
On the Select target(s) page, select Target Type as ‘AWS service’
Under Select a target, choose ‘SNS topic’
Choose the name of the Topic you had created as part of initial webhook setup.
Click ‘Next’ and 'Next' again, leaving the defaults
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!