π¨βπ»π€ Clayton, a cutting-edge code analysis platform designed specifically for Salesforce, has joined the Gearset family! Check out our website to learn more.
Once you've created your Gearset pipeline, you can use Clayton as a status check for incoming PRs that move across your static environments.
To get a sense of what this looks like in action, the video below showcases how it looks on your pipeline once integrated.
With that in mind, let's get started with creating this on your pipeline.
Adding a repository in Clayton
On the Clayton side, you'll need to connect the repository that you are using in Gearset to Clayton. This can be done on the Clayton side by following the steps on the Clayton Help Center article linked to the button below.
Enabling Clayton Automation for that Repository
Next, you'll need to enable the automation component of Clayton to let it decide whether or not incoming PRs are fit to be promoted. This can be done on the Clayton side by following the steps on the Clayton Help Center article linked to the button below.
Creating a Quality Gate in your VCS
Moving on, you'll need to create a quality gate in your version control system - otherwise known as a branch protection rule in this case. Depending on which VCS you have, the process for adding these gates is different - so we have created separate documents for each popular VCS (CodeCommit coming soon) on how to create these gates.
This can be done in your VCS directly by following the steps on the Clayton Help Center article corresponding to the VCS that you use that are linked to the buttons below.
Promoting a PR in your Gearset Pipeline
After finishing the aforementioned steps, you should be good to go! Upon opening a pull request to an environment in your pipeline - if a PR were to fail any required status checks on a branch that has the setting of needing status checks to succeed, Gearset will not be able to promote that PR as shown in the example below:
Fixing PRs in Clayton using FixBot
At this point, you might be wondering... how do I fix the PRs that fail status checks that I cannot promote in Gearset? At this stage, Clayton comes in handy by letting you jump directly to the repository in question to see a high-level overview of what is failing your configured policies. You can get to this page simply by selecting the Details
text next to any failed status check on the Gearset pipeline.
We can easily examine violations down to the PR by clicking the Pull Requests
tab and selecting the specific Pull Request in question.
Upon selecting the PR, you can click into the scan report and dive deeper into the quality gate violations. In this case, for anything that can be fixed by Clayton's FixBot feature, it can be easily selected and wrapped right back up into a PR that can pass that aforementioned status check to allow deployment to succeed. (This process is kicked off by selecting Fix all
)
On the next page, you'll be able to select Create pull request
in the top right corner.
Merging Clayton FixBot fixes back into Gearset Pipeline
Once Clayton has created a remediation for the issue, you will see a FixBot pull request going into your sandbox where the feature branch was originally created as seen here.
By selecting that icon, you can see the PR that was created by Clayton and merge it in Gearset. Upon doing so, this fix will be automatically applied to your dev sandbox and feature branch - meaning that you will then be cleared for deployment. π