0
votes

at the moment I am starting the build in Jenkins when a comment is written in the Merge request in Gitlab. I do it in Jenkins job configuration like enter image description here

How can I do that in a declarative jenkinsfile I saw how to do it for push events but not for comments.

 triggers {
        gitlab(triggerOnPush: true, triggerOnMergeRequest: true, branchFilterType: 'All')
    }

i cannot find anything in the gitlab documentation. https://github.com/jenkinsci/gitlab-plugin#job-trigger-configuration

1

1 Answers

1
votes

Just add to pipeline's gitlab trigger:

triggers {
    gitlab(
        ...
        triggerOnNoteRequest: true,
        noteRegex: "restart pipeline",
        ...
    )
}

Also set webhook in gitlab to be triggered with "Comments"