Search code examples
jenkins-pipelinejenkins-groovygerrit-trigger

gerrit triggerOnEvents entire list for groovy script


Team,

where can i find the entire list of this function triggerOnEvents? I want to know what all exists and use them as i need. like i knew two that i specified but I want to know what the all that exists in that list.

ref https://plugins.jenkins.io/gerrit-trigger/

    triggers {
        gerrit (
            serverName: 'git.compa.com',
            gerritProjects: [[
                compareType: 'PLAIN',
                disableStrictForbiddenFileVerification: false,
                pattern: 'team',
            ]],
            triggerOnEvents: [
                changeMerged(),
                patchsetCreated(excludeDrafts: false),
            ]

Solution

  • In general when you want to find the DSL usage of a specific plugin you can use the Jenkins Job DSL API which is actually available on your own Jenkins installation once you install the Job DSL Plugin.

    To access this API go to <YOUR_JENKINS_URL>/plugin/job-dsl/api-viewer/index.html

    IN your case, while in the API index just search for gerrit or triggerOnEvents (assuming gerrit-trigger plugin is installed) and you will get all the usage instructions. Example from the API for triggerOnEvents:

    triggerOnEvents {
        changeAbandoned()
        changeMerged()
        changeRestored()
        commentAdded {
            verdictCategory(String value)
            commentAddedTriggerApprovalValue(String value)
        }
        commentAddedContains {
            commentAddedCommentContains(String value)
        }
        draftPublished()
        patchsetCreated {
            commitMessageContainsRegEx(String value)
            excludeDrafts(boolean value)
            excludeNoCodeChange(boolean value)
            excludePrivateState(boolean value)
            excludeTrivialRebase(boolean value)
            excludeWipState(boolean value)
            uploaderNameContainsRegEx(String value)
        }
        privateStateChanged()
        refUpdated()
        rerunCheck()
        topicChanged()
        wipStateChanged()
    }