I might have been misunderstood the concept, but does not a Codebuild step fail when there is an error in your code and it can not build that code? I assumed that if one command in my build commands fails, it will notify me and/or stop the further after build actions.
I have a very simple Codebuild that suppose to run a python code (my unit tests in this case). Below is my buildspec.yml:
version: 0.2
phases:
build:
commands:
- echo Build started on `date`
- echo Compiling the Python code...
- pythonk run_unittests.py
post_build:
commands:
- echo Build completed on `date`
In that run_unittests.py file there is a syntax error.
When the run ends, it shows it as a success, but in the log files, I see it sees python syntax error is logged!
The only way I get to fail this is when there is an error in my buildspec.yml file, not inside my python file! It even goes to the next step in the CodePipleline!!
Am I misunderstood? And if not how can I get this to fail on the python code or unit test asserts?
Below is the lines that I see in the details:
Traceback (most recent call last):
File "/codebuild/output/...py", line 33, in test_func
poo
NameError: global name 'poo' is not defined
----------------------------------------------------------------------
Ran 5 tests in 0.000s
FAILED (errors=2)