title: git describe --tags does not work on Jenkins pipeline build
body: <p>I've seen <a href="https://stackoverflow.com/questions/10268641/jenkins-git-plugin-git-describe-cannot-describe-anything">this question</a> which goes in a similar direction but not quite. The problem there was that the tags were simply not pushed correctly.</p>
  
  <p>I am currently using Jenkins to build my python projects using <code>setuptools_scm</code>, which basically uses <code>git describe</code> to get a (more or less) sensible version number, even if not on a tag. The pipeline is defined using a seed job in JobDSL like this (abbreviated to get to the main points):</p>
  
  <pre><code>import BuildProjects
  
  BuildProjects.build_projects.each { def bproject -&gt;
     multibranchPipelineJob("tool/${bproject}") {
        branchSources {
           branchSource {
              source {
                 git {
                    id('tool_${bproject}')
                    remote("${BuildProjects.scmBaseLocation}/${bproject}.git")
                    credentialsId(BuildProjects.scmUser)
                    traits {
                       gitBranchDiscovery()
                       gitTagDiscovery()
                       cloneOptionTrait {
                          extension {
                             shallow(false)
                             noTags(false)
                             reference('grmblwrx')
                             timeout(1)
                          }
                       }
                    }
                 }
              }
           }
        }
  
     }
  }
  </code></pre>
  
  <p>Some configuration values are taken from <code>BuildProjects</code>.</p>
  
  <p>When running jenkins, I see that it fetches tags:</p>
  
  <pre><code> &gt; git fetch --tags --progress -- ssh://git@git.my-company.net/tools.git +refs/heads/*:refs/remotes/origin/* # timeout=1
  </code></pre>
  
  <p>and in fact, I can see the tags when I output them in my Jenkinsfile using an</p>
  
  <pre><code>sh "git tag"
  </code></pre>
  
  <p>block. But using</p>
  
  <pre><code>sh "git describe --tags"
  </code></pre>
  
  <p>gives</p>
  
  <pre><code>fatal: No tags can describe '&lt;Commit hash&gt;'.
  Try --always, or create some tags.
  </code></pre>
  
  <p>I read somewhere that this might be due to a sparse checkout: The commits between the tag and the current HEAD might be missing. Upon closer inspection, I found in my logs</p>
  
  <pre><code>&gt; git config core.sparsecheckout # timeout=10
  &gt; git checkout -f &lt;Commit hash&gt; # timeout=10
  </code></pre>
  
  <p>right after the <code>git fetch</code> line shown above. It seems that somehow my configuration in the JobDSL is not respected. Any ideas?</p>