Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic error message when having multiple gpg keys #228

Open
ghostbuster91 opened this issue Feb 6, 2022 · 1 comment
Open

Cryptic error message when having multiple gpg keys #228

ghostbuster91 opened this issue Feb 6, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@ghostbuster91
Copy link
Contributor

If user has multiple keys and the imported one isn't the default one (which is often the case in my opinion) the signing process will failed with not very helpful message:

[info] gpg: signing failed: Bad passphrase
[info] gpg: signing failed: Bad passphrase
[error] stack trace is suppressed; run last rules2_11 / signedArtifacts for the full output
[error] (rules2_11 / signedArtifacts) Failure running 'gpg --batch --pinentry-mode loopback --passphrase ... --detach-sign --armor --use-agent --output /home/kghost/workspace/scalafix-unified/rules/target/jvm-2.11/unified_2.11-0.0.2+3-29124f7a+20220206-1145-SNAPSHOT.pom.asc /home/kghost/workspace/scalafix-unified/rules/target/jvm-2.11/unified_2.11-0.0.2+3-29124f7a+20220206-1145-SNAPSHOT.pom'.  Exit code: 2
[error] Total time: 5 s, completed Feb 6, 2022, 11:45:06 AM

After carefully inspecting the gpg command we might notice that there is no information about which key to use.

sbt-pgp exposes usePgpKeyHex method to explicitly set key which will be used to perform operations. https://github.com/sbt/sbt-pgp#configuration-signing-key

I think that it should be possible to obtain key_id during the process and set it somewhere among the lines: https://github.com/sbt/sbt-ci-release/blob/main/plugin/src/main/scala/com/geirsson/CiReleasePlugin.scala#L143

Otherwise, please consider adding some note to the readme with the link to relevant section in the sbt-pgp.

@SethTisue
Copy link
Member

A PR on this would be welcome.

@SethTisue SethTisue added the help wanted Extra attention is needed label Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants