Error sending to agent: Inappropriate ioctl for device

I’m using the docker image circleci/openjdk:8-jdk to build my maven project (POM in this case). After the build, I want to deploy this automatically to sonatype and for this, I need first to sign the artifacts.

So I setup a workflow to do exactly this. As part of the workflow, I have a command to import my GPG key (setup via envvar in my context, where $GPG_SECRET_KEY is a base64-encoded secret key and $GPG_EXECUTABLE is gpg)

echo $GPG_SECRET_KEY | base64 --decode | $GPG_EXECUTABLE --import

But this returns the following error:

gpg: directory '/home/circleci/.gnupg' created
gpg: keybox '/home/circleci/.gnupg/pubring.kbx' created
gpg: /home/circleci/.gnupg/trustdb.gpg: trustdb created
gpg: key CFD0F16D74196593: public key "Thomas Bouron (Apache email address) <tbouron@apache.org>" imported
gpg: key CFD0F16D74196593/CFD0F16D74196593: error sending to agent: Inappropriate ioctl for device
gpg: error building skey array: Inappropriate ioctl for device
gpg: Total number processed: 1
gpg:               imported: 1
gpg:       secret keys read: 1
Exited with code 2

Any idea what is wrong here?

Ever find out a work around?

I was about to get it running using the following

 echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes
3 Likes

There’s lots of resources on the web for this.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Can confirm this does the trick :blush: :ok_hand:

I also had to do this beforehand:

echo use-agent >> ~/.gnupg/gpg.conf
echo pinentry-mode loopback >> ~/.gnupg/gpg.conf
echo allow-loopback-pinentry >> ~/.gnupg/gpg-agent.conf
echo RELOADAGENT | gpg-connect-agent
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.