Prevent codebuild failure based on certain exit codes

0

Hi

I have a command in my buildspec.yaml under build phase that returns different exit codes based on certain conditions. My understanding is that codebuild will fail the build for any none 0 exit codes. Is there a way to prevent/override this?

I need to run other commands based on the exit codes.

Thank you in advance

asked 4 years ago2996 views
2 Answers
0
Accepted Answer

Depending on what you're trying to run, you may be able to do something like this:

some-command-here; EXITCODE=$?

You can then evaluate $EXITCODE to determine your next steps.
Note that this requires a buildspec.yml version 0.2 or higher.

answered 4 years ago
0

Thanks, worked perfect.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions