title: How to get specific information about the current build project in Jenkins with Groovy?
body: <p>In Jenkins/Hudson, with the help of a Postbuild Groovy script, I would like to get one of the following:</p>
  
  <ul>
  <li>an environment variable (e.g. current JOB_NAME, BUILD_NUMBER etc.)</li>
  <li>the result of a specific build number of the current project</li>
  <li>the build number of the last not successful build in the current project</li>
  </ul>
  
  <p>At the moment I only found the following way, but it's rather limited:</p>
  
  <pre><code>def item = hudson.model.Hudson.instance.getItem("GroovyMultipleFailTest") 
  def build = item.getLastBuild()
  build.getNumber()
  </code></pre>