Track Migrations using Scorecards
Create Scorecards to filter file contents and track versions of libraries and tools during migrations
In this tutorial, you will learn how to use Scorecards to track and drive migrations. You will build custom checks using data points to track library and language versions from metadata file contents.
Before you begin
Before starting, ensure you have access to your Git provider through Git Integrations in the IDP admin section with API access enabled. Follow the connector creation steps to set up your connector.

A registered software component for which you want to track migration.
Scorecard checks
Harness IDP provides data points for Git-based data sources (GitHub, GitLab, etc.) that you can use to create custom checks in Scorecards. These checks can match and extract specific string patterns from any file in your source code. To learn more about creating checks, go to Scorecard Checks.
This feature is particularly useful for tracking versions in various files, such as:
.bazelrcfor JavaDockerfilefor Dockergo.modfor Gopackage.jsonfor React and JavaScriptManifest files
Create a custom check
Follow these steps to create a custom check for tracking migrations:
In your Harness IDP account, navigate to Configure → Scorecards
On the Scorecards page, go to the Checks tab and select Create Custom Check in the top-right corner
On the Create Check page, add the following information:
Name: Enter a descriptive name for your check (e.g., "Java Version Check")
Description: Describe what the check validates
Data Source: Select your Git provider (e.g., GitHub, GitLab, or Bitbucket)
Data Point: Select Extract String from a File to extract version information from files
Operation: Select All Of to ensure all rules must pass
Configure the rule using the Basic tab:
Branch Name (optional): Specify the branch name if you want to check a specific branch. If left empty, the system will use the branch from the
backstage.io/source-locationannotation in your entity YAMLFile Name: Specify the filename with its extension or the relative path from the root folder (e.g.,
.bazelrc,package.json,go.mod, ormanifest/Dockerfile)Pattern: Enter the regex pattern to match and extract the version. For example:
For Java version in
.bazelrcfile containingbuild --java_language_version=18, use:^build --java_language_version=(\d+)For Go version in
go.modfile containinggo 1.21, use:^go\s(\d+\.\d+)$For npm package in
package.jsoncontaining"eslint": "^7.7.0",, use:"eslint":\s"\^(\d+\.\d+\.\d+)",
Operator: Select the comparison operator (e.g., Equals, Greater Than, Less Than)
Value: Enter the expected value to compare against
(Optional) Add a Rule Description to provide context about what the rule validates
Click Save changes to save the check

Create a scorecard
Once you have created the checks, follow these steps to add them to a new Scorecard:
Navigate to Scorecards
Go to Configure → Scorecards
Select Create New Scorecard
Configure Basic Information
Name: Enter a descriptive name for your scorecard (e.g., "Java 18 Migration Tracker").
Description: Describe the scorecard's purpose (e.g., "Track migration to Java 18 across all services").
Add Filters (Optional)
Apply filters to specify which Catalog entities the scorecard should evaluate:
Kind: Select the entity kind (e.g., Component)
Type: Select the type for the chosen kind (e.g., Service)
Owners: (Optional) Select specific entity owners to evaluate
Tags: (Optional) Filter entities by tags
Lifecycle: (Optional) Select lifecycle stages (e.g., production)
Add Checks
Select the checks you created above to track the migration
These checks will evaluate specific criteria and return Pass or Fail results
Publish Scorecard
Review your configuration
Click Publish Scorecard to make it active

View scorecard results
Once your scorecard is published, you can view the results:
Navigate to the software component in your catalog.
Go to the Scorecards tab to view the scores.
You can re-run the check to compute the score instantly by clicking Rerun Checks.
Troubleshooting
Incorrect file path
Ensure the file path is relative to the root folder of the repository.
Pattern matching errors
Verify the accuracy of the pattern you are trying to match. Use regex101 to test your regex pattern. Also, ensure you have properly grouped the string you are trying to match using parentheses ().
Conclusion
In this tutorial, you learned how to use Scorecards in Harness IDP to track and drive migrations. This powerful feature helps you maintain up-to-date information on various aspects of your software projects, such as dependency versions, language versions, and tool configurations.
For more detailed information and support, refer to the Harness IDP documentation and community forums.
Last updated
Was this helpful?