在 Jenkins 下 运行 时,maven-gpg-plugin 因 "Inappropriate ioctl for device" 而失败
maven-gpg-plugin failing with "Inappropriate ioctl for device" when running under Jenkins
当 Jenkins 在远程 Linux shell 中触发 maven-gpg-plugin
时,它失败并返回 gpg: signing failed: Inappropriate ioctl for device
。这过去一直有效,直到最近。我不知道发生了什么变化。
我发现很多在线参考资料都建议 export GPG_TTY=$(tty)
但这不适用于 ssh 连接,因为 tty
是 null
。有什么想法吗?
找到了很好的解释
我会重新post post 的要点,以防页面出现故障:
If you 1) initially had it working in the past, and 2) have tried all sorts of solutions from the web, and still couldn’t get it working, chances are you have unconsciously upgraded GPG version from 2.0 to 2.1.
听起来不错...
To fix this, GPG 2.1 requires --pinentry-mode to be set to loopback in order to pick up gpg.passphrase value defined in Maven settings.xml.
So, update Maven GPG Plugin configuration in pom.xml to the following:
<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>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
当 Jenkins 在远程 Linux shell 中触发 maven-gpg-plugin
时,它失败并返回 gpg: signing failed: Inappropriate ioctl for device
。这过去一直有效,直到最近。我不知道发生了什么变化。
我发现很多在线参考资料都建议 export GPG_TTY=$(tty)
但这不适用于 ssh 连接,因为 tty
是 null
。有什么想法吗?
我会重新post post 的要点,以防页面出现故障:
If you 1) initially had it working in the past, and 2) have tried all sorts of solutions from the web, and still couldn’t get it working, chances are you have unconsciously upgraded GPG version from 2.0 to 2.1.
听起来不错...
To fix this, GPG 2.1 requires --pinentry-mode to be set to loopback in order to pick up gpg.passphrase value defined in Maven settings.xml.
So, update Maven GPG Plugin configuration in pom.xml to the following:
<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>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>