Configuring Change Requests
Change Requests work by accepting a GitHub webhook event for a pull request. Within CodeLogic, each repository has a unique configuration, enabling custom actions for each repo.
To add a repository configuration, select the ellipsis in the Change Request list Actions column and select Add or navigate to Admin → Change Requests and click on the Add Change Request button.
Repository Configuration
In the Change Request configuration modal:
- Add a Repository URL from which the Pull Request webhook events will originate
- Enter a Regular Expression Branch Pattern matching the branch naming used for Pull Requests
- For example:
feature/.*
will match any branch name starting withfeature/
- For example:
- Select a Comparison Workspace that contains the scanned code into which the Pull Request will be merged
- Choose a Retention Period for how long the server should retain the comparisons
Configuring GitHub Webhook
The following steps will walk you through creating webhook for CodeLogic's Change Request feature. To learn more about webhooks and how they are configured in GitHub, please refer to the GitHub Docs.
- Log in to GitHub.
- Within the settings page of your organization, select Webhooks from the menu on the left.
- Click Add webhook.
- Enter the payload URL.
Important
The payload URL is comprised of your server's address and /codelogic/server/webhooks/github/payload
For example, if your server name is myserver.com
, then your payload URL would be https://myserver.com/codelogic/server/webhooks/github/payload
- From the Content type drop-down menu, select application/json.
- If you are using SSL verification select Enable SSL verification.
- Select Let me select individual events.
- Select the following events:
- Pull requests
- Pull request review comments
- Pull request reviews
- Pull request review threads
- Click Add webhook.
Configuring Agents
CodeLogic Change Requests automatically find scans of the changes from a pull request in one of two ways. The CodeLogic server will locate the scan data based on the git hash matching the hash provided by the webhook, or it will locate the scanned artifact data in a specially named Scan Space correlating to the pull request.
Note
Using named Scan Spaces is recommended when setting up Change Requests as it does not clutter the Default Scan Space with scans from pull requests. Once a pull request is closed, the correlating pull request Scan Space is automatically removed by the CodeLogic server, minimizing disk usage.
Using Named Scan Spaces
The CodeLogic server will look for scanned artifact data in a Scan Space with a pattern matching REPOSITORY_URL|BRANCH_NAME
.
To configure an agent to scan into a named Scan Space, please refer to the agent configuration documentation.
As an example, if your pull request originates from the following repository https://github.com/CodeLogicIncEngineering/blog_references
in a branch named feature/CAPE-1983
you would pass the following Scan Space to the agent when scanning:
https://github.com/CodeLogicIncEngineering/blog_references|feature/CAPE-1983
.
Git Hash Lookup
Agents automatically locate and collect git information when scanning. The CodeLogic server uses this information to match the scanned artifacts with the appropriate pull request by utilizing the git hash. If git information is not available to the agents, you can manually specify a uniquely named Scan Space for the agent to store the artifact scans, which Change Requests can utilize for locating the appropriate data.