3 - New Relic Deployment Marker

Updated 4 months ago by Michael Cretzman

You can use the New Relic REST API v2 to record Harness deployments and then view them in the New Relic APM Deployments page and in the Event log list on the Overview page. For more information, see REST API Procedures from New Relic.

For example, here is a cURL command that sends a POST to the API to record a deployment:

curl -X POST 'https://api.newrelic.com/v2/applications/${APP_ID}/deployments.json' \
-H 'X-Api-Key:${APIKEY}' -i \
-H 'Content-Type: application/json' \
-d \
'{
"deployment": {
"revision": "REVISION",
"changelog": "Added: /v2/deployments.rb, Removed: None",
"description": "Added a deployments resource to the v2 API",
"user": "datanerd@example.com"
}
}'

In a Harness Workflow, you can add a New Relic Deployment Marker to perform the POST as part of your Workflow:

The API key parameter is provided by the New Relic Server you select, using the credentials you provided when you set up the New Relic Verification Provider in Harness.

The App ID parameter is provided by the Application Name you select. The list of applications is pulled from the New Relic Server you selected.

The Body section contains the standard JSON content as in the cURL example:

{
"deployment": {
"revision": "${artifact.buildNo}",
"description": "Harness Deployment via workflow ${workflow.name}",
"user": "${workflow.name}"
}
}

Harness uses some built-in variables to provide the revision information and other settings.

Now when the Workflow is deployed you will see the Deployment Marker vertical line in New Relic:

Next Step


How did we do?