How to Use Custom Property Product Mapping in Mend for GitHub Classic Repository Integrations
Overview
The customPropertyProductMapping
feature allows you to dynamically map GitHub repositories to different Mend applications based on custom properties set at the repository level. This provides flexible organization management where different teams or projects can be automatically grouped into separate Mend applications.
Prerequisites
GitHub App Permissions
For GitHub implementations using the Mend-hosted integration, no action is required. For self-hosted implementations, if you're updating an existing GitHub app, ensure the following permissions are configured:
Repository Permissions:
Custom properties → Read-only
Organization Permissions:
Custom properties → Read-only
Event Subscriptions:
Custom property
Custom property values
Important: After updating permissions, every organization owner where the app is installed must accept the change for it to take effect.
Step-by-Step Implementation
Step 1: Create Custom Properties in GitHub
Navigate to your GitHub organization settings
Go to Settings → Repository → Custom properties
Create a new custom property following the GitHub documentation
Example:
Property Name: Use a descriptive name. E.g.,
DevTeamsMendMapping
Description: For example: "Defines which Mend Application a repository is mapped to"
Default Value: None
Required: No
Step 2: Define Allowed Values (Optional)
To maintain consistency and prevent errors, define allowed values using a regex pattern:
Example Pattern: Team-.*
This allows values like:
Team-Frontend
Team-API
Team-Mobile
Team-Security
Step 3: Configure Mend Global Configuration
In your whitesource-config
repository, update the global-config.json
file:
{
...
"customPropertyProductMapping": "<CUSTOM PROPERTY NAME>"
}
Key Points:
The value should match exactly the custom property name you created in GitHub
If both
customPropertyProductMapping
andenableCustomProductMapping
are configured, onlycustomPropertyProductMapping
will be used
Step 4: Set Repository Custom Property Values
For each repository you want to map to a specific Mend application:
Go to the repository settings
Navigate to General → Custom properties
Set the custom property value. E.g.,
Team-API
Step 5: Verify the Mapping
After configuring the custom property, trigger a scan on the repository. The mapping will be applied automatically.
Example
Scenario
You want to organize repositories by different teams where each dev team gets its scan results mapped to its own Mend application.
Implementation
// global-config.json
{
...
"customPropertyProductMapping": "DevTeamsMendMapping"
}
Repository Configuration Examples
Repository | Custom Property Value | Resulting Mend Application | Resulting Mend Project |
---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
General Mapping Pattern
Application Name: Matches the custom property value (e.g.,
Team-Frontend
)Project Name: Follows the pattern
GH_<repository-name>
Logging
For self-hosted implementations, you'll see log entries similar to this in the Mend Controller logs:
[INFO] com.wss.common.http.RestApiConnector - Called SCM API [API_NAME=GET_REPOSITORY_CUSTOM_PROPERTIES;RESPONSE_CODE=200;...]
[INFO] com.wss.bolt.manager.ProjectManager - Custom product mapping added to repo. ..., new product name: Team-Frontend
Troubleshooting
Common Issues
Issue: Custom property not being recognized (self-hosted implementations)
Solution: Verify GitHub app permissions include custom properties (read-only)
Solution: Ensure organization owners have accepted permission changes
Issue: Mapping not applied to existing repositories
Solution: Trigger a new scan
Issue: Multiple applications created unexpectedly
Solution: Check for typos in custom property values
Solution: Implement regex validation for allowed values