3

I've written a test script I want to run in my setup commands of my codeship build. If it fails, I want it to cause the whole build to fail, which is normal behavior for things like unit tests.

In Travis CI, this seems well documented:

If any of the commands in the first four stages of the build lifecycle return a non-zero exit code, the build is broken

How can I accomplish this same behavior in codeship? I tried exiting my script with code 1, but the code ship kept right on a-sailin'.

Chris
  • 6,805
  • 3
  • 35
  • 50

1 Answers1

2

Exiting with code 1 does cause the build to fail, but only in the "test commands" or "test pipeline" box.

I had been incorrectly running tests in the "setup commands" box.

Now this final line in my python testing suite has the right behavior in codeship:

sys.exit(0 if success else 1)
Chris
  • 6,805
  • 3
  • 35
  • 50
  • Any non-zero exit code should mark the build as failed, even if you run that command via the setup commands. I realize this answer is a (tiny) bit late, but if this still occurs, please let us know via a ticket. – mlocher Aug 07 '17 at 14:28