我可能會誤解這個概念,但是當代碼出現錯誤並且無法構建該代碼時,Codebuild步驟不會失敗?我認爲如果我的構建命令中的一個命令失敗,它會通知我和/或在構建操作後停止。AWS CodeBuild for python不會失敗
我有一個非常簡單的Codebuild,假設運行一個python代碼(我的單元測試在這種情況下)。下面是我的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`
在這種run_unittests.py文件存在語法錯誤。
當運行結束時,它顯示它成功,但在日誌文件中,我看到它看到python語法錯誤已記錄!
我失敗的唯一方法是當我的buildspec.yml文件中有一個錯誤,而不是我的python文件!它甚至會進入CodePipleline的下一步!
我誤解了嗎?如果不是,我怎麼能得到這個在Python代碼或單元測試斷言失敗?
下面是我在細節見行:
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)