Propagate the Ruby entrypoint exit status from bin/gdk

What does this merge request do and why?

bin/gdk captured the exit status of gem/bin/gdk but never returned it. A bash script with no trailing exit returns the status of its last command, which here is the closing if, so every gdk <command> exited 0 even when the Ruby command failed. Scripts and CI that check the return code of gdk update could not detect a failure. The "not a GDK" branch printed an error and also exited 0.

  • Adds exit "${gdk_exit_status}" at the end of the GDK branch, so the launcher forwards the Ruby entrypoint's status unchanged, including 126 after the asdf hint.
  • Makes the "not a GDK" branch exit 1.
  • Points components/siphon/GDK.rb at the single siphon service. It still listed four service names from before they were consolidated, so gdk component list-services reports unassigned: siphon and exits 1. bin/gdk used to hide that. With the status forwarded, build-components-pipeline would start failing without this change.
  • Adds data/announcements/0051_gdk_exits_non_zero_on_failure.yml so the behaviour change is surfaced to users on their next gdk install or gdk update.

gem/bin/gdk and GDK::Command.run already compute the status correctly. This is the shell-side counterpart of !2060 (merged).

Behaviour change: gdk commands that failed but exited 0 now exit non-zero. A wrapper script or CI job that was silently passing on a failed gdk command will start failing.

Replaces !6166 (closed), which could not run its jobs from a personal fork.

Fixes #3366 (closed)

How to set up and validate locally

  1. Run a command that fails and check the status:

    $ ./bin/gdk rake nope:not-a-task >/dev/null 2>&1; echo "outer=$?"
    outer=1

    On main this prints outer=0.

  2. Run it from a directory that is not a GDK: (cd /tmp && /path/to/gdk/bin/gdk status >/dev/null 2>&1; echo "rc=$?") prints rc=1.

  3. A successful command still exits 0: ./bin/gdk config get port; echo $?.

  4. ./bin/gdk component list-services; echo $? prints unassigned: <none> and exits 0.

Verification

bash -n bin/gdk passes. I ran the launcher against a stub gem/bin/gdk that exits with a requested code:

Inner exit main outer This MR outer
0 0 0
1 0 1
7 0 7
126 0 126
nested subdirectory, inner 3 0 3
not a GDK directory 0 1

I could not run shellcheck or the Ruby specs locally. The main column is what #3366 (closed) reports, not something I re-ran. bin/gdk has no spec harness.

Impacted categories

Merge request checklist

  • This MR references an issue describing the change.
  • This change is backward compatible. If not, include steps to communicate to users. (See the behaviour change above; announcement added.)
  • Tests added for new functionality. If not, raise an issue to follow-up. (bin/gdk has no spec harness. Covered by the stub test above.)
  • Observability added/updated (logging, metrics, tracing).
  • Documentation added/updated.
  • Announcement added for notable changes.
  • gdk doctor test added.
  • This contribution was prepared with the help of an AI assistant. I reviewed the changes and take responsibility for them.
Edited by V K Adhithiya Kumar

Merge request reports

Loading
Loading