Skip to main content
Skip table of contents

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

  1. Navigate to your GitHub organization settings

  2. Go to SettingsRepositoryCustom properties

  3. 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:

JSON
{
  ...
  "customPropertyProductMapping": "<CUSTOM PROPERTY NAME>"
}

Key Points:

  • The value should match exactly the custom property name you created in GitHub

  • If both customPropertyProductMapping and enableCustomProductMapping are configured, only customPropertyProductMapping will be used

Step 4: Set Repository Custom Property Values

For each repository you want to map to a specific Mend application:

  1. Go to the repository settings

  2. Navigate to GeneralCustom properties

  3. 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

JSON
// global-config.json
{
  ...
  "customPropertyProductMapping": "DevTeamsMendMapping"
}

Repository Configuration Examples

Repository

Custom Property Value

Resulting Mend Application

Resulting Mend Project

frontend-web

Team-Frontend

Team-Frontend

GH_frontend-web

frontend-components

Team-Frontend

Team-Frontend

GH_frontend-components

frontend-utils

Team-Frontend

Team-Frontend

GH_frontend-utils

api-service

Team-API

Team-API

GH_api-service

api-gateway

Team-API

Team-API

GH_api-gateway

mobile-app

Team-Mobile

Team-Mobile

GH_mobile-app

mobile-sdk

Team-Mobile

Team-Mobile

GH_mobile-sdk

security-tools

Team-Security

Team-Security

GH_security-tools

security-scanner

Team-Security

Team-Security

GH_security-scanner

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:

CODE
[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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.