Needs keyword

I used the needs keyword to make the b job run only when the a job is successful, but it’s not working properly. Is there another way to achieve this? Please help me out.

Hi,

Please provide your .gitlab-ci.yml file and describe what exactly is not working as you expect.

Please note that in order for a job to fail, one of your commands in the scripts section must exit with non-zero code. Only then GitLab will consider job as failed, and even by default won’t execute any jobs in the following stages. If all your commands exit with code 0, even if they are not successful, GitLab will consider them as successful and go on.