-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-2142] [Regression] dbt 1.5.0 return invalid exit codes. #7010
Comments
@elongl Thanks for the early beta testing, and for the quick report! I can reproduce this:
I've queued this up with the other bugs that we've been uncovering after the switchover to new CLI / API. |
@jtcohen6 Thanks a lot for addressing. |
Documented behavior: https://docs.getdbt.com/reference/exit-codes Previous logic for this: Lines 128 to 157 in 0c06735
Potential way of handling this in This resolves the issue for me locally, though it doesn't account for "unhandled" errors (= exit code 2): def cli(ctx, **kwargs):
"""An ELT tool for managing your SQL transformations and data models.
For more documentation on these commands, visit: docs.getdbt.com
"""
@cli.result_callback()
def process_result(command_result: Tuple[Any, bool], **kwargs):
results, success = command_result
if success:
exit_code = ExitCodes.Success.value # 0
else:
exit_code = ExitCodes.ModelError.value # 1
ctx = click.get_current_context()
ctx.exit(code=exit_code)
# not accounted for here:
# ExitCodes.UnhandledError.value (=2) if KeyboardInterrupt/click.Abort or BaseException |
Thanks for reporting the issue! I use |
Is this a regression in a recent version of dbt-core?
Current Behavior
Errored models and failed tests return 0.
Expected/Previous Behavior
They should return 1.
Steps To Reproduce
Run a model with a syntax error on dbt 1.5.0+.
Relevant log output
Environment
Which database adapter are you using with dbt?
postgres
Additional Context
No response
The text was updated successfully, but these errors were encountered: