Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gpg: signing failed: secret key not available

I have an artifact hosted on maven. my setup on the local windows machine has been working perfectly; maven, gpg keys name it. upto now I can do 'mvn clean deploy' and my artifact gets signed and released very successfully.

Enter continous integration with jenkins hosted on an ubuntu server. I successfully install gpg on ubuntu via putty. Since I already have versions of the artifact on maven signed with my gpg keys, I should continue using them right?

So, I use winscp to transfer the gnupg folder and all its contents to ubuntu. Indeed when I run gpg --list-keys, I can see my key information (I only have one key configured). I am thinking, this, is a sign that my configuration on ubuntu is successful.

According to an answer to this question I should take that there are no keys configured on ubuntu. So why would gpg --list-keys work??

When jenkins is trying to deploy the artifact, the "sign" goal fails and maven-gpg-plugin reports this:

gpg: no default secret key: secret key not available
gpg: signing failed: secret key not available

and the build fails, how can I resolve this issue?

like image 501
egimaben Avatar asked Oct 31 '22 08:10

egimaben


1 Answers

I have found the solution. The only thing I was missing was the settings.xml file for my particular maven project. I had to find out where maven looks for this file from while building my project (usin mvn -X). Somehow Ubuntu did not create it, so I had to create one for myself and put in the relevant gpg properties. After this, everything worked like a breeze.

like image 169
egimaben Avatar answered Nov 01 '22 20:11

egimaben