Maven-gpg-plugin and --pinentry-mode loopback to sign artifacts of the build

I’m trying to get my maven build to sign the artifacts it produces. I have the ‘maven-gpg-plugin’ working fine locally, but on travis-ci, it appears the gpg-agent does not support using “–pinentry-mode loopback” option. Here’s the CI build error:

[INFO] --- maven-gpg-plugin:1.6:sign (sign-artifacts) @ nexus-format-archetype ---
gpg: setting pinentry mode 'loopback' failed: Not supported
gpg: signing failed: Inappropriate ioctl for device
gpg: signing failed: Inappropriate ioctl for device

The ‘maven-gpg-plugin’ is configured to send the key passphrase like so:

          <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <gpgArguments>
            <gpgArgument>--pinentry-mode</gpgArgument>
            <gpgArgument>loopback</gpgArgument>
          </gpgArguments>
        </configuration>
      </plugin>

FWIW, I made sure the various gpg keys are imported from env vars and successfully loaded into the travis gpg db.

I stumbled about trying to reconfigure the gpg-agent to support --pinentry, but failed. Any idea how I can get this working on Travis? Thanks!

I have exactly the same issue, did you manage to solve this somehow?

Best regards,
Fabian

Without seeing the build, can’t say anything for sure.

According to https://www.fluidkeys.com/tweak-gpg-2.1.11/ and https://lists.gt.net/gnupg/devel/78147#78147, you need to either upgrade to Bionic or add allow-loopback-pinentry into gpg-agent.conf.

Hi,

I am also facing the same issue. Did you find a solution?

Thanks

Hi,

I have finally found a solution using gpg2 and the latest ubuntu distribution (dist: bionic): https://github.com/f-lopes/spring-mvc-test-utils/commit/7bbb74de9c056a4a809f55bc7eea5987ade7393a#diff-354f30a63fb0907d4ad57269548329e3.

1 Like