Repository Integrations - Multiple Branches with Global Config
This article explains how to use multiple branches with Global Config in your Mend for Developers integration (GitHub.com, GitHub Enterprise, GitLab and BitBucket Server).
In Mend for Developers integrations (GitHub.com, GitHub Enterprise, GitLab and BitBucket Server) it is possible to have multiple branches under Global Config settings of your whitesource-config repo. This is helpful when you have to configure scans and the custom configurations are used by a larger group. In these scenarios it is often easier to manage a branch than it is to manage individually updating the .whitesource files on a per repo basis.
Global Config setup example:
MyOrg/whitesource-config
branch main (default)
global-config.json
repo-config.json -- main settings that uses default Python2
branch gradle
global-config.json
repo-config.json -- have Gradle Additional Arguments enabled in external whitesource.config file
branch python3
global-config.json
repo-config.json -- have Python 3 enabled in external whitesource.config file
branch renovate
global-config.json
repo-config.json -- have Renovate settings enabled under remediateSettings
The above sample setup is useful for organizations with multiple dev teams that have different custom configuration requirements.
For example, teams that always have to run certain additional Gradle arguments to build their projects (gradle.additionalArguments needs to be used). In this case, you can set "configMode": "EXTERNAL" and "configExternalURL": "pointing to a whitesource.config file where "gradle.additionalArguments=-Pbranch=dev -PbuildWithSources=false" in the MyOrg/whitesource-config/gradle/repo-config.json

Another instance could be, if some dev teams use Python 2 but others use Python 3 (python.path=python and python.path=python3). This is an example where you might want to have "configMode": "EXTERNAL" and "configExternalURL": "pointing to a whitesource.config file where "python.path=python3" in the MyOrg/whitesource-config/python3/repo-config.json
python.path=python (Python 2) is the default behavior as of now. So if there are no other additional parameters that need to be custom configured, then it can be kept under the Default Branch, as indicated in Global Config setup example.

Another common example if when different teams want to adjust the settings in the repo-config.json itself. For example, if some teams want renovate enabled, and some don't:

What is the whitesource.config file?
The whitesource.config file is used to set the same parameters in the Mend for Developers integrations that are set within the wss-unified-agent.config file for Unified Agent scans. The only difference is that you do not need to set up apiKey, wss.url, productName, projectName, as the integration already has all the onboarded repositories associated with your Mend Organization.
The whitesource.config file can have only a few parameters listed it in (for example, just python.path=python3). The parameters that are not listed will apply the default values, that can be found here: Unified Agent Configuration Parameters
How to implement:
Create Global Config "whitesource-config" repo with multiple branches. You can find examples above
In the .whitesource file of a repository where you need to apply certain custom configurations point the .whitesource file to that branch that carries out that custom configuration. Example:
CODE{ "settingsInheritedFrom": "MyOrg/whitesource-config@python3" }
Note: Multiple branches with Global Config option is possible only if "repoConfigMode":"createOnboardingPR" or "repoConfigMode":"pushWhitesourceFile". It will not work with "repoConfigMode":"noWhitesourceFile"