title: Jenkins Shared Library - Accessing Git Changeset related info
body: <p>I have a Jenkins shared library with bunch of Git repos involved.</p>
  
  <ul>
  <li>Repo 1: <strong>Jenkins Shared Library repo</strong> which is globally configured in Jenkins.</li>
  <li>Repo 2: <strong>Application code repo</strong> which has the actual application code.</li>
  <li>Repo 3: <strong>Application config repo</strong> which has configuration files for various environments of the application.</li>
  </ul>
  
  <p>The pipeline has various steps like checkout, build, code quality check, unit test, build and deployments.</p>
  
  <p>We use Jenkins provided email template in the shared library to notify the build status. Example code:</p>
  
  <pre><code>def nTo = globalNotificationSettings.mail.to ?: ""
  def nEnabled = globalNotificationSettings.mail.enabled ?: false
  def nSubject = "${nBuildStatus}: Job ${env.JOB_NAME} Build #${env.BUILD_NUMBER}"
  def nBody = '''${SCRIPT, template="groovy-html.template"}'''
  
  if(nTo &amp;&amp; nEnabled) {
      emailext body: nBody, \
          subject: nSubject,\
          to: nTo, \
          mimeType : 'text/html'
  }
  </code></pre>
  
  <p>The resulting email ends up showing all the changes consolidated into one single table and doesn't show changes per repo. For a quick reference, the email template is available at <a href="https://github.com/jenkinsci/email-ext-plugin/blob/master/src/main/resources/hudson/plugins/emailext/templates/groovy-html.template" rel="nofollow noreferrer">Jenkins CI github</a>.</p>
  
  <p>Upon further analysis, its obvious that the email extension uses <a href="https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/GitChangeSet.java" rel="nofollow noreferrer">GitChangeSet object</a> and it doesn't seem to have the information on which repo the changeset is coming from.</p>
  
  <p><em>Is there a way someone can suggest to get hold of the below info inside Shared Library?</em></p>
  
  <ul>
  <li><strong>List of changesets being processed by the build at the repo level</strong></li>
  <li><strong>I'm not looking for a solution to modify the template. Rather, I need help/guidance on how to access the changeset at a repo level using Jenkins Shared Library. Especially, access the repo info for Jenkins Shared Library which is configured globally in Jenkins.</strong></li>
  </ul>