Search code examples
gitlabgitlab-cigitlab-ci-runner

Gitlab CI: Fail pipeline if variable not set?


Is there a way fail my entire pipeline if the user triggered the pipeline and didn't set a variable called options with a value?

I've tried things like only and rules but they just skip the job instead of failing all jobs.


Solution

  • Yes, though the way you fail would be dependent on the system your runner's based on.

    For example, in a Linux/bash based runner, all you need is exit 1 (as opposed to exit 0) to stop execution and fail the pipeline