PREQ-7525 Fail promote job when multi-repo promotion API call returns an error - #329
Conversation
The multiRepoPromote Artifactory plugin call in promote_multi() only printed the JSON response without checking it for errors, so an error response (e.g. HTTP 404 when the plugin execution isn't registered) was silently ignored and the Promote job reported success even though no artifact was actually promoted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Ensures the multi-repo Artifactory promotion step fails fast (and annotates the workflow) when the multiRepoPromote plugin returns an error response, preventing silent “success” in GitHub Actions that later causes confusing downstream failures.
Changes:
- Capture and print the
jf rt curlresponse inpromote_multi(), and fail the step when the JSON response contains anerrorsfield. - Add ShellSpec coverage for the real-world 404 plugin error response case.
- Extend the ShellSpec
jqmock to support the new.errorschecks.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
promote/promote.sh |
Adds JSON error detection/step failure logic for multi-repo promotion responses. |
spec/promote_spec.sh |
Adds tests and mock behavior to validate failing on multi-repo promotion error responses. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…keep ::error single-line - Fail loudly (instead of silently succeeding) when the multiRepoPromote plugin returns a non-JSON response, e.g. a gateway error page or empty body on a transient failure. - Don't treat an empty `errors` array as a failure. - Use `jq -c` and flatten the raw response with `tr` so the emitted ::error:: workflow command stays on a single line even when the Artifactory response is pretty-printed JSON spanning multiple lines. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Code Review ✅ Approved 2 resolved / 2 findingsAdds error handling to the multi-repo promotion API call to fail the job when Artifactory returns an error, addressing the non-JSON/empty-errors edge cases and single-line annotation formatting. ✅ 2 resolved✅ Edge Case: Non-JSON / hard curl failures still slip through
✅ Edge Case: An empty
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar



Summary
sonar-scanner-enginePR #525 where thePromotejob (withmulti-repo: true) reported success on GitHub, but the actual JFrogmultiRepoPromoteplugin call returned a 404 (The execution name 'multiRepoPromote' could not be found.). Becausepromote_multi()only printed the curl response without inspecting it, the failure was silently swallowed, the artifact was never promoted tosonarsource-private-dev, and the downstream deploy job failed later with a confusing "no artifact found" error.promote_multi()check the JSON response for anerrorsfield and fail the step (with a clear::error::annotation) when the Artifactory plugin call itself fails, instead of only failing much later in an unrelated deploy job.Test plan
./run_shell_tests.sh(viamise exec -- shellspec spec/promote_spec.sh --shell bash) — 32 examples, 0 failures, including a new case simulating the exact 404 response seen in the wildshellcheck promote/promote.sh— clean🤖 Generated with Claude Code