I am new to CircleCI and recently created a following workflow for a CI automation:
I have 4 jobs that I want running in sequence (so every job depends on successful completion of the previous job). This is working fine for me.
Now, I want to run these jobs only if a certain condition applies (basically inspect a git command results and make a decision whether or not to run a CI job). I found 2 ways of achieving this:
using circleci step halt - the issue with this is it halts only the current job, so CircleCI return a success for that job. This causes the other jobs to run as well. But I dont want it to run any job and just terminate entirely.
other workaround is to return an exit 1 error code, so it makes the current job “fail”, so no other jobs will run which depend on the success of the current job. However, I don’t like the fact that CircleCI will show the job as failed (if a certain condition isn’t applied.
Is there any other elegant solution to achieve this?