deployment-marker-action
deployment-marker-action copied to clipboard
could not initialize New Relic client
We are getting the following when trying to create a marker for our app in GitHub Actions:
level=fatal msg="could not initialize New Relic client, make sure your profile is configured with
newrelic profile configure
"
This is the step configuration we have:
- name: Create New Relic OTEL Application Deployment Marker
if: ${{ steps.guid_otel.outputs.guid != '' }}
uses: newrelic/[email protected]
with:
apiKey: ${{ secrets.api_key }}
region: "EU"
guid: ${{ steps.guid_otel.outputs.guid }}
version: ${{ steps.version.outputs.version }}
deeplink: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
user: "${{ github.actor }}"
We've had markers working some time before, so I don't know what has happened.
Hi @juupas, thanks for reporting. So far I haven't been able to reproduce the issue. That error message typically means credentials are missing. Can you double check your API key is set in your GitHub secrets?
My team encountered this as well. The issue was that secrets aren't passed through to "reusable workflows" GH docs.
Working example
jobs:
...
notify:
uses: ./.github/workflows/deploy-notifications.yml
secrets:
new_relic_api_key: ${{ secrets.NEW_RELIC_API_KEY }}
with:
new_relic_deployment_entity_guid: <REDACTED>
# deploy-notifications.yml
name: Notify of the most recent deployment
on:
workflow_call:
secrets:
new_relic_api_key:
required: true
description: "The New Relic API key."
inputs:
new_relic_deployment_entity_guid:
required: true
type: string
jobs:
newrelic:
runs-on: ubuntu-latest
name: New Relic Deployment Marker
steps:
- name: Set Release Version from Tag
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: New Relic Application Deployment Marker
uses: newrelic/[email protected]
with:
region: "US"
apiKey: ${{ secrets.new_relic_api_key }}
guid: ${{ inputs.new_relic_deployment_entity_guid }}
version: "${{ env.RELEASE_VERSION }}"
user: "${{ github.actor }}"
From what we went through debugging this image locally - I have a few recommendations for the NR team.
- Pin
deployment-marker-action
to a versionedFROM
image of the NR CLI instead of using latest. This will avoid any breaking (or unknown) changes happening in the CLI that might break this Action. Fortunately this wasn't the case. I.E.FROM newrelic/cli:latest --> FROM newrelic/cli:v0.68
- Better error messaging than what is given from the CLI. Possibly solutions:
- Work with the CLI team to have a better error message than what we currently get about profile not being configured. A profile isn't actually necessary for the CLI to work. The actual error is that NEW_RELIC_API_KEY is unset/blank.
- If working with the CLI team isn't an option update
entrypoint.sh
to do the precondition check- making sure NEW_RELIC_API_KEY is set and has a value.
Agreed we should have better error messaging :)