Honeybadger deployment notification with curl
Shell command to tell Honeybadger about a new deployment:
curl --data "deploy[revision]=$(date -u +%Y%m%d%H%M%S)_$(git rev-parse --short HEAD)&api_key=$HONEYBADGER_API_KEY" "https://api.honeybadger.io/v1/deploys"
Params:
$REVISION
- revision id. can be an arbitrary string value. In this example revision id is based on current timestamp (presumable date and time of deployment) and head revision id for the current working copy. Example:20230723092717_00a9703
.$HONEYBADGER_API_KEY
- Honeybadger API key.
Getting Honeybadger API key:
Project page → Settings → API keys
Ansible task:
- name: clone or update sources
ansible.builtin.git:
# ...
register: git_result
- name: notify honeybadger.io about the deployment
community.general.honeybadger_deployment:
token: "{{lookup('env', 'HONEYBADGER_API_KEY')}}"
environment: "production"
user: "ansible"
revision: "{{git_result.after}}"
repo: "{{git_url}}"
References: