Why multiple line shell code doesn't fail the bulid in codebuild project?

Viewed 60

I am using codebuild for CI and I implement some scripts in build spec file. A piece of the code is a multiple line if command, like:

 - |
        if [ [ -v $DB_TABLE_NAME  ] && [ $IS_PRIMARY_REGION != 'true' ] ]; then
          yarn test 
        elif [ [ $IS_PRIMARY_REGION == 'false' ] ]; then
          yarn test $PRIMARY_REGION
        fi

the issue is if yarn test inside if fail, the codebuild project doesn't fail. It finished as success. How can I make the multiple line statement fail the build?

0 Answers
Related