0

I don't know how to use the gerrit-trigger plugin in a DSL pipelineJob. According to the dsl plugin doc triggers is deprecated for pipelineJobs. And from the wiki 1.77 replaced by pipelineTriggers. So I have change my triggers section to

properties {
    pipelineTriggers {
        triggers {
            gerrit {
                events {
                    patchsetCreated()
                }
                project('**My/Git/Repo', '**')
            }
        }
    }
}

However, when I use pipelineTriggers i get the following

ERROR: (configure_seed_jobs.groovy, line 25) No signature of method: events() is applicable for argument types: (configure_seed_jobs$_run_closure1$_closure4$_closure9$_closure10$_closure11$_closure12) values: [configure_seed_jobs$_run_closure1$_closure4$_closure9$_closure10$_closure11$_closure12@3bcd6c54] Possible solutions: gerritProjects(), buildFailureMessage(), buildNotBuiltMessage(), buildStartMessage(), buildSuccessfulMessage(), buildUnstableMessage(), buildUnsuccessfulFilepath(), changeSubjectParameterMode(), commentTextParameterMode(), commitMessageParameterMode(), customUrl(), dependencyJobsNames(), dynamicTriggerConfiguration(), escapeQuotes(), gerritBuildFailedCodeReviewValue(), gerritBuildFailedVerifiedValue(), gerritBuildNotBuiltCodeReviewValue(), gerritBuildNotBuiltVerifiedValue(), gerritBuildStartedCodeReviewValue(), gerritBuildStartedVerifiedValue(), gerritBuildSuccessfulCodeReviewValue(), gerritBuildSuccessfulVerifiedValue(), gerritBuildUnstableCodeReviewValue(), gerritBuildUnstableVerifiedValue(), gerritSlaveId(), nameAndEmailParameterMode(), notificationLevel(), serverName(), silentMode(), silentStartMode(), skipVote(), triggerConfigURL(), triggerOnEvents()

What am I missing?

Oscar
  • 1
  • I now found the version specific API reference under https:///plugin/job-dsl/api-viewer/index.html. Listing API methods, some of which are in the "Possible solutions". Maybe the API hosted at https://jenkinsci.github.io/job-dsl-plugin/ should be pointing at the latest and greatest? – Oscar Apr 24 '20 at 06:35

1 Answers1

1

I had the same problem, because either events{..} or project() is no more available to gerrit in pipelineTriggers, you should use triggerOnEvents {..} and gettitProjects{...} instead. For more details, you could find them in the document on your jenkins (e.g. http://0.0.0.0:8080/plugin/job-dsl/api-viewer/)

properties {
  pipelineTriggers {
    triggers {
      gerritTrigger {
        gerritProjects {
          gerritProject {
            compareType('PLAIN')
            pattern('**My/Git/Repo')
            branches {
              branch {
                compareType('PLAIN')
                pattern('master')
              }
            }
          }
        }
      triggerOnEvents {
        changeMerged()
      }
    }
  }
}
chsieh
  • 11
  • 1