fix: wait_for_termination returns actual exit status - #1265
Conversation
84f3d65 to
399c93f
Compare
dd6cb82 to
4e5b186
Compare
|
Ah...we just had the same/similar in stackabletech/stackable-utils#130 It's an annoying trap. |
in this context, it is not a huge deal - from what I checked it does not interfere with OOM based restarts or something like that - but getting the actual exit codes may be nice and should be an improvement. |
maltesander
left a comment
There was a problem hiding this comment.
A couple of things. Almost all downstream products require changes:
- https://github.com/stackabletech/trino-operator/blob/77bcf6da54ac49fb2d896388f791611f79984a50/rust/operator-binary/src/controller/build/command.rs#L145
- https://github.com/stackabletech/nifi-operator/blob/4d6cea98741fb34c29d28ae4e13931dcb317d817/rust/operator-binary/src/controller/build/resource/statefulset.rs#L404
Will abort under set -e with non-zero code, neither create_vector_shutdown_file_command or other lines after that will be executed (e.g. the vector shutdown file etc.). So || product_exit_code=$? should be added and rolled out with an operator-rs release properly?
And i think a similar problem for git-sync containers
It could make sense to stop that test script duplication (i think its in over 10 places) and e.g. use insta (already in the repo) as dev/test dependency? Something like:
insta::assert_snapshot!(
serde_yaml::to_string(&git_sync_resources.git_sync_containers.first()).unwrap()
);
| term_child_status=$? | ||
| trap - TERM | ||
| wait ${term_child_pid} 2>/dev/null | ||
| if [ "${term_child_status}" -gt 128 ]; then |
There was a problem hiding this comment.
Can we add a flag / comment for the 128?
There was a problem hiding this comment.
addressed here: f3a4fee
still looking into insta.
Description
since
set -eis the last part ofwait_for_terminationit always has exit code 0. With this, it returns the exit code of the process it is waiting for instead.[ "${term_child_pid}" ]blows up when the child pid is not set yet, so gets changed to[ -n "${term_child_pid:-}" ].Definition of Done Checklist
Author
Reviewer
Acceptance