Add Honeycomb release markers to classic buildpack publish#369
Add Honeycomb release markers to classic buildpack publish#369colincasey wants to merge 3 commits into
Conversation
edmorley
left a comment
There was a problem hiding this comment.
Sorry missed these on the first pass, only realised when looking at the similar heroku/cnb-builder-images#989
| existing=$(curl -sS --retry 3 --retry-all-errors --max-time 30 "${auth[@]}" "${api}" \ | ||
| | jq -r --arg url "$url" 'map(select(.url == $url)) | first | .id // empty' 2>/dev/null) || existing="" | ||
|
|
||
| if [[ -n "$existing" ]]; then |
There was a problem hiding this comment.
Do we want to be updating the entry if an existing one exists? It feels like we can/should just skip in that case?
In which case this also means the implementation here can be written with much less duplication.
| >/dev/null && echo "Updated existing release marker (${existing})" \ | ||
| || echo "::warning::Failed to update Honeycomb release marker (publish succeeded regardless)" | ||
| else | ||
| curl -sS --retry 3 --retry-all-errors --max-time 30 -X POST "${api}" "${auth[@]}" -d "${body}" \ |
There was a problem hiding this comment.
Could you add the missing standard curl best practices like --fail and --connect-timeout? (Without --fail, we won't get the annotation when the API returns a non-200 value etc)
| # publish updates the existing marker rather than stacking a duplicate line on the board. | ||
| # Every path below warns on failure and never exits non-zero — a Honeycomb outage must | ||
| # not fail an already-successful publish. | ||
| existing=$(curl -sS --retry 3 --retry-all-errors --max-time 30 "${auth[@]}" "${api}" \ |
There was a problem hiding this comment.
I don't think we should pipe errors to /dev/null - let them be printed as is (only the stdout gets captured by the $() so the stderr is fine to still print, since it will be shown directly in the logs)
d910c1f to
0e8582b
Compare
Adds an optional
honeycomb_api_keysecret to the classic buildpack publish workflow. When a caller passes it, a best-effort, idempotent marker is posted to the Honeycombbuildsdataset on a successful production publish.What
honeycomb_api_keysecret on_classic-buildpack-publish.yml'sworkflow_callinterface.Behavior
env.MODE == 'production'— QA/staging publishes don't post markers.|| echo "::warning::..."and never exits non-zero; a Honeycomb outage can't fail an already-successful publish.The dataset slug
buildsis hardcoded (shared by all classic buildpacks, gated by the API key, not sensitive). Only the API key is a secret.W-22846373