Report a non-zero exit code if build fails
If any part of a build fails, the CLI should exit with a non-zero code.
So much in favor of this. I'm working for a CI company and just looked at the build of one of our users, which is all green even though all steps involving the Modulus CLI actually failed :(
Is there a way we could work around this at the moment?
@tzmanics We actually have error handling in place in the CLI that will return a nonzero exit code on process error. Is this an issue of an error not being thrown during a specific use case?
@musgravejw This is not a local process error, but an error in a remote process. The CLI at this point in the deploy is a dumb pipe for the log, so we will probably need to add some string parsing. Maybe looking for something like npm does:
it worked if it ends with ok
I saw an example that looks like this issue today:
31.3 MB written
Uploading project...
Deploying project into Node.js runtime...
Starting build.
Creating directories for build environment.
Build attempt failed, attempting again.
Starting build.
Creating directories for build environment.
Build attempt failed, attempting again.
Starting build.
Creating directories for build environment.
Build failed, reverting project.
[✓] ${projectName} running at ${domain}.onmodulus.net
at which point the deploy command ended with a zero exit code. Since the deploy actually failed ("Build failed") I would have expected a non-zero exit code in this case.