Use Catalog Ingestion API
Steps to use Catalog Ingestion API to ingest metadata and use the information on catalog overview and workflows
In this tutorial we will be using the catalog metadata ingestion APIs to add additional metadata for the software components in the catalog, display them in the component overview page using additional info card and track the values ingested using Scorecard.
Before you begin
You must have components registered in your software catalog. If you do not have any components registered, follow this tutorial to register one. We recommend you to register this software component for this tutorial.
Add a new metadata
Use cURL command
Use the following command to add a new metadata
codeCoverageScoreto thewarehousecomponent.
OR
Use the python script
You can use the python script, to auto-update the
<+metadata.codeCoverageScore>
OR
Use Harness pipeline
We recommend the use of following Harness Pipeline to add a new metadata
codeCoverageScoreto thewarehousecomponent. While using the following pipeline YAML make sure to add thex-api-keyas pipeline variable of type secret and nameapikey.
Schedule a cron to update the catalog metadata
If you use the cURL command or the python script to auto-update the metadata on regular intervals you need to configure a cron job.
In case you are using Harness Pipeline use a trigger to update the data ingested on regular intervals. Create a pipeline trigger of type Cron to schedule an hourly trigger.
Code coverage scorecard {#code-coverage-scorecard}
In case you want to track the information you have ingested using Scorecards, follow the steps below.
Go to the Scorecards and under Configure and select Checks from the top nav.
Now select Create Custom Check and add a New Custom Check to check the code coverage score, select the data source as Catalog Info YAML and data point as Evaluate Expression(JEXL).
Add the jexl to be evaluated as
<+metadata.codeCoverageScore>and operatorGreater than or equal tofrom the dropdown and add the value as50Now you can create a scorecard using the Custom Check you have created above.
Now go to the Warehouse Software Component in the Catalog, and you will find the Code Coverage Scorecard under the Scorecards tab and on the overview page. Go to Scorecards custom data sources to read more.
Additional info card {#additional-info-card}
In case you want to display the same information you have ingested on your Overview page as an additional card, follow the steps below.
Go to the Layout Page and under Configure and select Catalog Entities.
Now Select Edit Layout for component Service and add the following under Overview card.
Now go to the Warehouse Software Component in the Catalog, and you will find an additional info card populated with information we ingested using the API above. You can read more about additional info card
Note: For detailed instructions on adding an Additional Info Card to display custom information on your entity's Overview page, see the Additional Info Card section in the Catalog Layout documentation.
Conclusion
Using the Catalog Metadata Ingestion API, you can source information into your catalog from internal systems such as cost trackers, service health checkers, security scans, or even from simple spreadsheets tracking personnel details and use them to just display the information to users as wells as use them as an input for workflows.
Check out other examples of the Catalog Ingestion API.
Last updated
Was this helpful?