Spooneres
Spooneres

Reputation: 3

How not to run pipelines on specific commit message

I have pipeline that makes some changes and commits another change which triggers another pipeline and I dont want that automatic update to trigger pipeline.

I had an idea that I will specify commit message and that ignore it, but for some reason I cannot get it working.

Can you help me with that?

variables:
  COMMIT_MESSAGE: "MyCommitMessage"

workflow:
  rules:
    - if: $CI_COMMIT_MESSAGE != $COMMIT_MESSAGE
...

Upvotes: 0

Views: 2202

Answers (1)

fmdaboville
fmdaboville

Reputation: 1771

You have to add the never keyword and use a regex like this :

variables:
  COMMIT_MESSAGE: "MyCommitMessage"

workflow:
  rules:
    - if: $CI_COMMIT_MESSAGE =~ /^.*COMMIT_MESSAGE/
      when: never
    - when: always

The if will be evaluate to true and the pipeline will never run.

Upvotes: 3

Related Questions