Configure the mapping file
The resource mapping file is a YAML file that is used, in collaboration with your DevOps team, to link optimization findings to your version-controlled configurations in GitHub.
As part of the process of enabling optimization for selected resources, you download a template for the mapping file. This mapping template contains:
-
A list of the selected resource identifiers
-
Reference metadata
-
Placeholder fields for the Git branch and the corresponding source file paths where each resource is defined
To configure the mapping:
-
Use your organization's conventions or the relevant tooling standards to locate the corresponding resource definitions in GitHub.
-
For each resource, add the correct GitHub branch and files.
-
Save the file with the name .repo_remediation.
-
Commit the completed
.repo_remediationfile to the root of the default branch of the relevant GitHub repository.
If your organization manages infrastructure across multiple teams, you can split the mapping template into multiple files. These files must be recombined into a single file, before committing the file.
Use the following examples as a guide to configuring the mappings.
Example mapping file: unpopulated
version: v1 services: entity-ef726e: files: [] branch: ' '
When you first download the mapping file, it is in template form, with the services block populated with the resource names/identifiers for the optimizations you selected. The files and branch for each service are left empty for your DevOps team to complete.
To configure the file, follow these guidelines:
-
The
versionfield is required and must currently be set tov1to pass schema validation. -
Each entry in the
servicesblock is a unique resource identifier. The value is an object with:-
files: an array of file paths where the resource is defined (such as Helm chart templates or values files) -
branch: the Git branch where the files are located
-
Example mapping file: configured
When the file is configured, the format resembles the following example:
# Example .repo_remediation file version: v1 # Mapping of resource to Helm charts and values files services: account:regionX:cluster:namespace:servicename:container1: files: - charts/resource-a/templates/deployment.yaml - charts/resource-a/templates/service.yaml - charts/resource-a/values.yaml branch: main account:regionX:cluster:namespace:servicename:container2: files: - charts/resource-b/templates/deployment.yaml - charts/resource-b/templates/service.yaml branch: testing
How the mapping file is used
When you upload the mapping file, it is validated against a predefined schema. Only findings included in a valid .repo_remediation.yaml file can be optimized.
When the mapping file is committed, Perforce Unified Compliance detects the changes since the last version was committed, and parses the updated mappings. It stores the mappings internally and uses them to generate issues for valid entries.
If a resource identifier appears multiple times in the file, the last entry is used.
If a resource is missing or incorrectly mapped, no issue is raised for that finding. The resource remains unmapped, and any related findings remain open in the Optimizations window.