nacho4d
nacho4d

Reputation: 45118

How to trigger gitlab ci when a comment like "test please" is written in merge request discussion?

I saw there are several ways to trigger the CI.

Even for merge requests https://docs.gitlab.com/ee/ci/merge_request_pipelines/

What I want to do is to trigger a gitlab CI pipeline not for all merge request and not for all commits. Only when someone comments:

'test please' or 'test gitlab' or some special keyword maybe defined by regex?

Is this possible?

Upvotes: 6

Views: 3385

Answers (1)

VonC
VonC

Reputation: 1327004

That was requested in gitlab-org/gitlab-foss issue 39215, and shipped with 11.0

rspec:
  script: ...
  only:
    variables:
      - $CI_COMMIT_MESSAGE =~ /some-regexp/

You also have the following workaround for pipelines (windows cmd shell):

Process the job only if commit message doesn't contain [CI Release]

script:
        - git show -s --format=%%B | findstr /C:"[CI Release]" >nul 2>&1 && (exit 0) || (set errorlevel=0)
        - cd beUcb
        - call mvn -N -Pver resources:resources
        - REM ... rest of script ...

Upvotes: 2

Related Questions