A way to stop pipeline without making it failed

I have a pipeline with 20 steps and at step 5 I am making a decision whether to continue pipeline or not. Both cases are ok. I am struggling to find a proper way to stop the pipeline without making it failed.
When using command like ''exit 1" - it will mark whole pipeline as failed.
Another option is to make check for the step 5 at each of the steps 6,7 … 20 - that looks very ugly!
Another option is to split the pipeline into 2 pipelines like steps 1-5 and 6-20 - here the problem would be at UI level, because the most part of the pipeline will be hidden and it is not obvious that it can be displayed by clicking at some part on UI.

Is there any better way available which I am missing?

We’ve gone for your second option:

Another option is to make check for the step 5 at each of the steps 6,7 … 20 - that looks very ugly!

Although “ugly”, once we changed our entire pipeline to parallel then it felt more comfortable and flexible. Instead of relying on the sequence of steps as documented in the YAML file, we are now solely relying on the dependencies between steps to document how steps depend on each other.

Note that we found it much less ugly when we switched from this terse syntax:

when:
  steps:
   - name: build
     on:
       - success

To the shorthand version:

when:
  steps:
    - name: build

Now that I at peace with explicitly documenting the relationship of my steps, I feel more comfortable, free, and flexible :smiley:.

Hey @heroInCommunity

Could you share a bit about your use case and what is exactly is the decision?

In general however, we propose creating many “dumb” pipelines instead of a single smart one that takes too many decisions.