Skip to content
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

CLI exits with exitcode 0 even if operation failed #1230

Closed
bdudabeecoded opened this issue Jul 3, 2024 · 3 comments
Closed

CLI exits with exitcode 0 even if operation failed #1230

bdudabeecoded opened this issue Jul 3, 2024 · 3 comments
Labels

Comments

@bdudabeecoded
Copy link

Expected Behavior

vtex publish|install|deploy should exit with code <> 0 (e.g. exitcode 2) when operation failed
vtex link --no-watch should exit with code <> 0 (e.g. exitcode 2) when operation failed

$ vtex publish
OK

$ vtex publish
20:55:33.775 - error: Publishing failed. [email protected]  
20:55:33.828 - error: App build failed with message: Version '1.0.8' of app 'xxxxxxxxxxxxx.xxxxxxxxxxxxxxxx' has already been published.
20:55:33.829 - error: Failed to publish [email protected]
20:55:33.873 - info: Logged into xxxxxxxxxxx as [email protected] at workspace master  
20:55:33.873 - info: Switched from xxxxxxxxxxx to xxxxxxxxxxx
$ echo $?
2

☝️ exitcode is 2 as the operation failed

$ vtex install [email protected]
20:49:31.889 - error: Installation failed!  
20:49:31.890 - error: Failed to list versions and states by timestamp for notexist.nosuchapp: invalid character '<' looking for beginning of value
20:49:31.890 - warn: The following app was not installed: [email protected]
$ echo $?
2

☝️ exitcode is 2 as the operation failed

$ vtex deploy [email protected]
20:51:17.877 - error: Error patching publication metadata in new index: Error getting publication index and history: Error reading new publication index: App not published: notexist.nosuchapp
20:51:17.920 - info: Logged into xxxxxxxxxxx as [email protected] at workspace master  
20:51:17.920 - info: Switched from xxxxxxxxxxx to xxxxxxxxxxx 
$ echo $?
2

☝️ exitcode is 2 as the operation failed

$ vtex deploy [email protected]
21:00:41.286 - error: Error patching publication metadata in new index: Error getting version in publication index: Version not published yet
$ echo $?
2

☝️ exitcode is 2 as the operation failed

Current Behavior

$ vtex publish
OK

$ vtex publish
20:55:33.775 - error: Publishing failed. [email protected]  
20:55:33.828 - error: App build failed with message: Version '1.0.8' of app 'xxxxxxxxxxxxx.xxxxxxxxxxxxxxxx' has already been published.
20:55:33.829 - error: Failed to publish [email protected]
20:55:33.873 - info: Logged into xxxxxxxxxxx as [email protected] at workspace master  
20:55:33.873 - info: Switched from xxxxxxxxxxx to xxxxxxxxxxx
$ echo $?
0

☝️ exitcode is 0 although the operation failed

$ vtex install [email protected]
20:49:31.889 - error: Installation failed!  
20:49:31.890 - error: Failed to list versions and states by timestamp for notexist.nosuchapp: invalid character '<' looking for beginning of value
20:49:31.890 - warn: The following app was not installed: [email protected]
$ echo $?
0

☝️ exitcode is 0 although the operation failed

$ vtex deploy [email protected]
20:51:17.877 - error: Error patching publication metadata in new index: Error getting publication index and history: Error reading new publication index: App not published: notexist.nosuchapp
20:51:17.920 - info: Logged into xxxxxxxxxxx as [email protected] at workspace master  
20:51:17.920 - info: Switched from xxxxxxxxxxx to xxxxxxxxxxx 
$ echo $?
0

☝️ exitcode is 0 although the operation failed

$ vtex deploy [email protected]
21:00:41.286 - error: Error patching publication metadata in new index: Error getting version in publication index: Version not published yet
$ echo $?
0

☝️ exitcode is 0 although the operation failed

Context

Any CLI should exit with non 0 exit code if the operation failed. We're automating deployments and currently we work around this by parsing the output -> not always accurate

Your Environment

Version used: 4.0.4

@bdudabeecoded bdudabeecoded changed the title CLI exists with 0 even if operation failed CLI exits with exitcode 0 even if operation failed Jul 3, 2024
Copy link

github-actions bot commented Aug 3, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Aug 3, 2024
@bdudabeecoded
Copy link
Author

IS there anybody out there?

@github-actions github-actions bot removed the Stale label Aug 6, 2024
Copy link

github-actions bot commented Sep 5, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant