Job getting succeeded even when there is an error in gitlab-ci

i have created ci-cd for my maven project, while running the job, my maven build was failed. but job was success. so my next job also start executing.

my requirement is, build-job should get stopped after build failure, and job status should be failed.

can anyone help on this

GitLab Runner relies on commands exit codes. So even if there are errors, but the command still returns zero exit code for GitLab runner this means everything is fine.
In order to fail the job you need to ensure that anything in your script returns a non zero exit code.

1 Like

Thanks, Can you please share some example script. see my maven is failing in console level, how can i add condition in script level

Can you please send me some sample