Search code examples
gitlabcontinuous-integrationgitlab-ciworkflowpipeline

Problem with setting worflows rules for pipeline


I have a problem with setting rules for the pipeline. I need to set when the pipeline is running and when is not running for $CI_COMMIT_MESSAGE. But somewhere is the problem.

I need rules:

if the commit message is "Generated doc for KMP" then stop the pipeline

if the commit message is not "Generated doc for KMP" then run the pipeline

variables:
  CI_DOKKA_KMP: "Generated doc for KMP"
  
workflow:
  rules:
    - if: '$CI_COMMIT_MESSAGE == "$CI_DOKKA_KMP"'
      when: never
    - when: always

Solution

  • CI_DOKKA_KMP: "[ci skip]Generated doc for KMP"
    
    workflow:
     rules:
       - if: $CI_COMMIT_MESSAGE =~ /^\[ci skip\]/
         when: never
       - when: always
    

    It's solved :)