Search code examples
jenkinsversion-controljenkins-workflowjenkins-pipeline

How to get culprits or committers inside a Jenkins workflow with one or more SCMs


Is it possible to access information about committers and/or culprits of a Jenkins workflow job when checking out from one or more SCMs (either via checkout() or other SCM steps like git/svn)?

The intention is to use that information to notify committers and/or culprits about the job status, for example in a mail step.

A small example of a workflow definition:

node {
  // checkout from one or more SCMs, e.g.
  git url: '<URL>' 
  checkout([$class:...])
  ...

  // how can we know about committers or culprits at this point?
  $committers = ??

  // send a mail to committers or culprits
  mail to: '$committers', subject: 'JENKINS', body: '<information about the job status>'
}

How could this be adapted to get a collection of the committers after running the SCM steps?

Edit: I am currently working with Jenkins version 1.596.2 and Workflow: Aggregator version 1.6 and it seems this is an open issue in JENKINS-24141


Solution

  • As you found, pending JENKINS-24141 this is not supported. Changes to Jenkins core are required.