How to make gitlab-ci fail when there is an sql error?

The goal is to make the gitlab-ci fail when there is an sql error.

toto.sql

select 1 from idontexist -- generate sql error

toto.sh

@toto.sql

gitlab-ci.yaml

script:
    - |
      chmod +x ./toto.sh
      ./toto.sh

How can I detect this sql error to make job fail?

the job result has no error in gitlab ci:

$ chmod +x 
./toto.sh 
SQL Error [942] [42000]: ORA-00942: table or view does not exist
Job succeeded


Read more here: https://stackoverflow.com/questions/67929790/how-to-make-gitlab-ci-fail-when-there-is-an-sql-error

Content Attribution

This content was originally published by Tyvain at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: