title: Automatically sign build artifact from Jenkins
body: <p>I'm writing a library that uses cmake. I've set the build up to add a <code>make</code> target that builds a Debian source package that I can then upload to Launchpad with <code>dput</code> to create an Ubuntu PPA. Part of this process is signing the package with my <code>gpg</code> key. When I run this <code>make</code> target while logged into a normal X session it pops up a box that asks me for my <code>gpg</code> passphrase.</p>
  
  <p>I want to have Jenkins do this automatically to upload a daily snapshot build. The question is how to get Jenkins to sign the package automatically. I've seen similar questions but they never really answered what I'm looking for.</p>
  
  <p>I assume I need to run <code>gpg-agent</code> to handle this but here are the things I don't understand:</p>
  
  <p>1.) Jenkins runs under the <code>jenkins</code> user. How do I get <code>gpg-agent</code> running for this user. I've seen that <code>eval $(gpg-agent --daemon)</code> can be put in a shell script startup file but that wouldn't get sourced by Jenkins.</p>
  
  <p>2.) How do I make <code>gpg-agent</code> aware of my passphrase. If I log in to the <code>jenkins</code> user with <code>sudo su - jenkins</code> I can use <code>gpg</code> to decrypt a file but it pops up <code>pinentry-curses</code> and asks for my passphrase. How would this be handled from Jenkins. I'd like to enter my passphrase once and have it remembered.</p>