title: Jenkins pipeline Warnings Next Generation Plugin: git rev-parse HEAD^{commit} takes a (too) long time
body: <p>This is the relevant part of the <code>Jenkinsfile</code>:</p>
  
  <pre><code>stage('Static Code Analysis') {
      options {
          timeout(time: 1, unit: 'HOURS')
      }
      steps {
          withMaven(jdk: "${JDK_VERSION}", maven: 'M3', mavenLocalRepo: '.repository') {
              sh 'mvn --no-transfer-progress verify --activate-profiles qa -Dpmd.analysisCache=true'
          }
          recordIssues(tools: [
                  checkStyle(),
                  pmdParser(),
                  spotBugs(useRankAsPriority: true)
          ])
          dependencyCheckPublisher pattern: 'target/dependency-check-report.xml'
      }
  }
  </code></pre>
  
  <p>This is an excerpt from the Jenkins console log:</p>
  
  <pre><code>00:10:26.471  [CheckStyle] Successfully parsed file /home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop/target/checkstyle-result.xml
  00:10:26.471  [CheckStyle] -&gt; found 0 issues (skipped 0 duplicates)
  00:10:26.847  using credential bd100583-6d56-496a-89c0-67e640c2f80e
  00:10:27.322  using credential bd100583-6d56-496a-89c0-67e640c2f80e
  00:10:26.896   &gt; /usr/bin/git rev-parse HEAD^{commit} # timeout=10
  00:10:27.699  using credential bd100583-6d56-496a-89c0-67e640c2f80e
  00:10:28.173  using credential bd100583-6d56-496a-89c0-67e640c2f80e
  00:10:27.748   &gt; /usr/bin/git rev-parse HEAD^{commit} # timeout=10
  00:12:10.218   &gt; /usr/bin/git rev-parse HEAD^{commit} # timeout=10
  00:25:35.352  [CheckStyle] Post processing issues on 'jenkins-node-aws' with source code encoding 'UTF-8'
  00:25:35.352  [CheckStyle] Creating SCM blamer to obtain author and commit information for affected files
  00:25:35.352  [CheckStyle] -&gt; Git blamer successfully created in working tree '/home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop'
  00:25:35.352  [CheckStyle] Creating SCM miner to obtain statistics for affected repository files
  00:25:35.352  [CheckStyle] -&gt; Git miner successfully created in working tree '/home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop'
  00:25:35.352  [CheckStyle] Resolving file names for all issues in source directory '/home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop'
  00:25:35.352  [CheckStyle] -&gt; resolved paths in source directory (1238 found, 0 not found)
  00:25:35.352  [CheckStyle] Resolving module names from module definitions (build.xml, pom.xml, or Manifest.mf files)
  00:25:35.352  [CheckStyle] -&gt; resolved module names for 85004 issues
  00:25:35.352  [CheckStyle] Resolving package names (or namespaces) by parsing the affected files
  00:25:35.352  [CheckStyle] -&gt; resolved package names of 1238 affected files
  00:25:35.352  [CheckStyle] No filter has been set, publishing all 85004 issues
  00:25:35.352  [CheckStyle] Creating fingerprints for all affected code blocks to track issues over different builds
  00:25:35.352  [CheckStyle] -&gt; created fingerprints for 85004 issues (skipped 0 issues)
  00:25:35.352  [CheckStyle] Invoking Git blamer to create author and commit information for 1238 affected files
  00:25:35.352  [CheckStyle] GIT_COMMIT env = 'HEAD'
  00:25:35.352  [CheckStyle] Git commit ID = '62d4a2abfda51f58acac8f4ce8e799dffcdbfb0a'
  00:25:35.352  [CheckStyle] Git working tree = '/home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop'
  00:25:35.352  [CheckStyle] -&gt; blamed authors of issues in 1238 files
  00:25:35.352  [CheckStyle] Blaming of authors took 498 seconds
  00:25:35.352  [CheckStyle] Analyzing the commit log of the Git repository '/home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop'
  00:25:35.352  [CheckStyle] Invoking Git miner to create statistics for all available files
  00:25:35.352  [CheckStyle] Git working tree = '/home/ubuntu/jenkins/workspace/iText_7_Java_itextcore_develop'
  00:25:35.352  [CheckStyle] -&gt; created statistics for 1238 files
  00:25:35.352  [CheckStyle] -&gt; created report for 1238 files in 69 seconds
  00:25:35.352  [CheckStyle] Copying affected files to Jenkins' build folder '/var/lib/jenkins/jobs/iText_7_Java/jobs/itextcore/branches/develop/builds/910/files-with-issues'
  00:25:35.352  [CheckStyle] -&gt; 1238 copied, 0 not in workspace, 0 not-found, 0 with I/O error
  00:28:49.752  [CheckStyle] Using reference build 'iText_7_Java/itextcore/develop #909' to compute new, fixed, and outstanding issues
  00:28:49.752  [CheckStyle] Issues delta (vs. reference build): outstanding: 85002, new: 2, fixed: 2
  00:28:49.752  [CheckStyle] No quality gates have been set - skipping
  00:28:49.752  [CheckStyle] Health report is disabled - skipping
  00:28:49.752  [CheckStyle] Created analysis result for 85004 issues (found 2 new issues, fixed 2 issues)
  00:28:49.752  [CheckStyle] Attaching ResultAction with ID 'checkstyle' to run 'iText_7_Java/itextcore/develop #910'.
  </code></pre>
  
  <p>Notice the jump in time stamp from <code>00:10:27.748</code> to <code>00:12:10.218</code> to <code>00:25:35.352</code>.
  I see a similar (although less extreme) jump in time stamps when Jenkins is doing the <code>recordIssues</code> for PMD and SpotBugs.</p>
  
  <p>This takes too long for just running <code>git rev-parse</code> and the delay is unacceptable. 13 minutes of doing absolutely nothing useful. No other jobs were running at the time. What is going on here and how to fix it?</p>
  
  <p>EDIT:</p>
  
  <p>The delay is <em>NOT</em>, and I repeat: <strong><em>NOT</em></strong> in the <code>mvn</code> command. It is in the <code>recordIssues</code> command.</p>
  
  <p>EDIT:</p>
  
  <ul>
  <li>It is not just with Checkstyle</li>
  <li>It is also with PMD and Spotbugs</li>
  </ul>
  
  <p>EDIT:</p>
  
  <p><code>recordIssues</code> is a Jenkins pipeline build step that comes from <strong>Warnings Next Generation Plugin</strong>.
  <a href="https://www.jenkins.io/doc/pipeline/steps/warnings-ng/#recordissues-record-compiler-warnings-and-static-analysis-results" rel="nofollow noreferrer">https://www.jenkins.io/doc/pipeline/steps/warnings-ng/#recordissues-record-compiler-warnings-and-static-analysis-results</a></p>