admin管理员组

文章数量:1123345

In continuous integration YAML file in GitLab, I want to check if a variable is included in a list of values with a single line.

Fo example, I want to check if the predefined GitLab variable CI_PIPELINE_SOURCE is "web" or "parent_pipeline" or "pipeline". I can do this with:

$CI_PIPELINE_SOURCE=="web" || $CI_PIPELINE_SOURCE=="parent_pipeline" || $CI_PIPELINE_SOURCE=="pipeline"

Is there a more elegant way to do the same?

本文标签: How to check if a variable is in a list in GitLab CIStack Overflow