Skip to content

Commit

Permalink
fix(shippy): set exit code based on upload status
Browse files Browse the repository at this point in the history
  • Loading branch information
ericswpark committed Sep 19, 2024
1 parent 244b1f3 commit b0738ae
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
3 changes: 2 additions & 1 deletion shippy/.idea/shippy.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions shippy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,12 @@ directory. Use with caution. Same as the `-y`/`--yes` flag shown above.

Enable debug mode for all invocations. When set to true, the `-d`/`--debug` flag will have no effect, and all
invocations of shippy will run with debug mode enabled.


# Status

shippy returns exit codes based on the results.

`1` - Ctrl-C exit

`2` - one or more builds failed to upload and/or set disabled status
11 changes: 10 additions & 1 deletion shippy/shippy/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@

console = Console()

failed_builds_exist = False


# Handle SIGINT gracefully and don't puke up traceback
def sigint_handler(*_):
Expand All @@ -67,6 +69,8 @@ def server_prechecks(client):


def check_and_upload_build(client, args, build_path):
global failed_builds_exist

# Check build file validity
if not check_build(client, build_path):
print_warning("Invalid build. Skipping...")
Expand All @@ -83,6 +87,7 @@ def check_and_upload_build(client, args, build_path):
except UploadException as exception:
logger.exception(exception)
print_error(exception, newline=True, exit_after=False)
failed_builds_exist = True


def search_and_upload_builds(client, args):
Expand Down Expand Up @@ -413,6 +418,10 @@ def main():
# Start uploads
search_and_upload_builds(client, args)

# Check exit condition
if failed_builds_exist:
exit(2)


if __name__ == "__main__":
main()
main()

0 comments on commit b0738ae

Please sign in to comment.