T
T
TemaKam2021-10-07 13:45:40
GitLab
TemaKam, 2021-10-07 13:45:40

What is wrong with regular expression in workflow?

workflow:
  rules:
    - if: "$CI_PIPELINE_SOURCE == 'web' && $PROCEDURE !~ /(export|import)/"
      when: never
    - if: "$CI_PIPELINE_SOURCE == 'web' && $STAND !~ /(dev|test|preprod|all)/"
      when: never

PROCEDURE and STAND are specified when starting the pipeline
, the goal is to check the specified variables so that they are only from a certain list
, what is the error here and is it possible to combine this into 1 condition with || ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-10-07
@karabanov

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "web" && $PROCEDURE !~ /regex-expression/ || $STAND !~ /regex-expression/'
      when: never

You can train with regulars here https://regex101.com/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question