title: How can I set Jenkins build description while triggering build via curl?
body: <p>I'm trying to set the build description of a build I'm triggering, as I'm kicking off the build, and I have no luck so far.</p>
  
  <p>I came across a solution (<a href="https://stackoverflow.com/questions/19235943/adding-text-to-the-page-of-a-build-triggered-by-the-jenkins-remote-api">Adding text to the page of a build triggered by the Jenkins remote API</a>), and I kind of got it to work this way (first command will kick off the build, second one will set the description of the last build):</p>
  
  <pre><code>curl -v -X POST "http://[myServer]/job/[jobName]/build"
  curl -v -X POST "http://[myServer]/job/[jobName/lastBuild/submitDescription" --data-urlencode "description=test description"
  </code></pre>
  
  <p>However, the problem is that if the build I just kicked off gets queued / doesn't kick of right away, "lastBuild" will not reference the build I just kicked off, but the one before it (that is still building).</p>
  
  <p>So I tried something like this:</p>
  
  <pre><code>payload='json={""description"":""test description""}'
  curl -v -X POST -H "Content-Type: application/json" -d $payload "http://[myServer]/job/[jobName]/build"
  </code></pre>
  
  <p>But it doesn't actually set the description.</p>
  
  <p>Any ideas how this can be achieved?</p>
  
  <p>Other solutions I found, but I'm not really happy with:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/25427622/changing-jenkins-build-name-description-through-api-in-java">Changing Jenkins Build Name &amp; Description through API in JAVA</a> - that's also a "post trigger solution" that won't work reliably same as just setting the description after</li>
  <li><a href="https://stackoverflow.com/questions/17839258/modifying-jenkins-description-for-a-build">Modifying Jenkins Description for a build</a> - I guess I could build in a check, and only modify the description when it's empty so I don't override it, but that seems rather complicated. I'm thinking there must be an easier solution to this, no?</li>
  </ul>