title: Get Jenkins upstream jobs
body: <p>I would like to get all the upstream jobs, just like in the console output:</p>
  
  <pre><code>Started by upstream project "allocate" build number 31
  originally caused by: 
  Started by upstream project "start" build number 12
  originally caused by: 
  </code></pre>
  
  <p>I've tried groovy postbuild with the following:</p>
  
  <pre><code>def build = Thread.currentThread().executable
  def causes= manager.build.getCauses()
  for (cause in causes)
  {
  manager.listener.logger.println "upstream build: " + cause.getShortDescription()
  
  }
  </code></pre>
  
  <p>but then I only get "allocate", not the "start" job.</p>
  
  <p>I've also tried </p>
  
  <pre><code>def build = Thread.currentThread().executable
  def test = build.getUpstreamBuilds()
  for (up in test)
  {
  manager.listener.logger.println "test build project: " + up
  }
  </code></pre>
  
  <p>but this is empty...</p>
  
  <p>Any ideas?</p>