Skip to content

v1.8.0 — reuse the change correlation without stamping

Choose a tag to compare

@markabrahams markabrahams released this 16 Aug 17:13
· 12 commits to main since this release

Added

  • defprod-stamp --list-changes — runs the identical change correlation as a stamp (both trailer forms, slug → productId, change lookup within the right product) and stops one step short of stamping, printing one JSON object per line:

    defprod-stamp --list-changes --range "$BEFORE_SHA..$AFTER_SHA"
    {"key":"CHG-126","slug":"acme-web","productId":"PRODUCT-…","changeId":"CHANGE-…"}
    

    Use it when something downstream needs the set of changes a git range carries — recording a deployment run, generating release notes, building a changelog — instead of writing a second implementation of the correlation that has to agree with this one forever. slug is null for a slug-less correlation. stdout carries data only, so jq -r .changeId gets the ids and jq -s 'map(.changeId)' gets the array a deployment-run API wants. It calls no mutating use case, so a read-scoped API key is enough.

    Unlike stamping, this mode reports failure: exit 0 when the correlation completed (the list may be legitimately empty), exit 3 when it did not (unreadable range, missing config, a key that did not resolve). Check it — an empty list and a broken run look identical otherwise. It also will not fall back to the configured DEFPROD_PRODUCT_ID when a slug fails to resolve, because a CHG-NN key is unique only within a product and the fallback can return a real change from a different product the range never carried; it omits the entry and exits 3. Cannot be combined with --stage/--start/--cancel/--fail/--note (exit 2).

Fixed

  • --help no longer truncates. The usage block was extracted with an absolute line range whose bounds sat on the first and last lines with no slack, so documenting any new flag silently cut the output short. Since --help is the documented capability-probe surface for CI callers, the failure mode was a caller not finding a flag the script does ship, and downgrading. The block is now delimited by sentinel comments.

Changed

  • The per-change success line (defprod-stamp: finishChangeStage build stamped for CHG-77) moved from stdout to stderr, so stdout is a clean data channel in every mode. Every message the script prints is now a diagnostic. Only affects a caller that parsed stdout for that progress line; it was never a documented contract.

Compatibility

Stamping is otherwise unchanged — same flags, same RPCs, same exit-0-always contract (a missed stamp is a visibility bug, not a deploy blocker). No existing invocation needs to change.

Upgrade

npx @defprod/scripts defprod-stamp --help
# or
npm install -g @defprod/scripts