jreleaser: [Unexpected error] Could not initialize keyring

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem (link to git repository is ideal)
  • Full description of the issue provided (see below)

Steps to Reproduce

  1. check out https://github.com/alttpj/emu2api/
  2. run jreleaser full-release

Expected Behaviour

release

Actual Behaviour

✔ ~/git/alttpj/emu2api [main|✔] 
09:02 $ jreleaser full-release 
[INFO]  JReleaser 0.3.0
[INFO]  Configuring with jreleaser.yml
[INFO]    - basedir set to /home/user/git/alttpj/emu2api
[INFO]  Reading configuration
[INFO]  Loading properties from /home/user/.jreleaser/config.properties
[INFO]  Validating configuration
[INFO]  Project version set to 1.0.0-SNAPSHOT
[INFO]  Release is snapshot
[INFO]  Timestamp is 2021-05-10T09:02:19.79443+02:00
[INFO]  HEAD is at 450e3fe
[INFO]  dryrun set to false
[INFO]  Generating changelog: out/jreleaser/release/CHANGELOG.md
[INFO]  Calculating checksums
[INFO]  Signing files
[INFO]  Writing output properties to out/jreleaser/output.properties
[ERROR] JReleaser failed after 0.258 s
Unexpected error when signing release.
Could not initialize keyring

Trace

[ERROR] JReleaser failed after 0.271 s
org.jreleaser.model.JReleaserException: Unexpected error when signing release.
        at org.jreleaser.workflow.SignWorkflowItem.invoke(SignWorkflowItem.java:35)
        at org.jreleaser.workflow.WorkflowImpl.execute(WorkflowImpl.java:51)
        at org.jreleaser.cli.Sign.doExecute(Sign.java:34)
        at org.jreleaser.cli.AbstractModelCommand.execute(AbstractModelCommand.java:64)
        at org.jreleaser.cli.AbstractCommand.call(AbstractCommand.java:72)
        at org.jreleaser.cli.AbstractModelCommand.call(AbstractModelCommand.java:38)
        at org.jreleaser.cli.AbstractCommand.call(AbstractCommand.java:37)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
        at picocli.CommandLine.access$1300(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
        at picocli.CommandLine.execute(CommandLine.java:2078)
        at org.jreleaser.cli.Main.execute(Main.java:73)
        at org.jreleaser.cli.Main.run(Main.java:59)
        at org.jreleaser.cli.Main.main(Main.java:51)
Caused by: org.jreleaser.util.signing.SigningException: Could not initialize keyring
        at org.jreleaser.engine.sign.Signer.createInMemoryKeyring(Signer.java:118)
        at org.jreleaser.engine.sign.Signer.sign(Signer.java:83)
        at org.jreleaser.workflow.SignWorkflowItem.invoke(SignWorkflowItem.java:33)
        ... 16 more
Caused by: java.io.IOException: public key ring doesn't start with public key tag: tag 0xffffffff
        at org.bouncycastle.openpgp.PGPPublicKeyRing.<init>(Unknown Source)
        at org.jreleaser.util.signing.InMemoryKeyring.addPublicKey(InMemoryKeyring.java:58)
        at org.jreleaser.engine.sign.Signer.createInMemoryKeyring(Signer.java:114)
        ... 18 more                                                                                                                                                                                                                                                 

Environment Information

  • Operating System: Ubuntu 20.04
  • JReleaser Version: 0.3.0
  • JDK Version: tried both:
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
# and
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
Eclipse OpenJ9 VM AdoptOpenJDK-11.0.11+9 (build openj9-0.26.0, JRE 11 Linux amd64-64-Bit Compressed References 20210421_975 (JIT enabled, AOT enabled)
OpenJ9   - b4cc246d9
OMR      - 162e6f729
JCL      - 7796c80419 based on jdk-11.0.11+9)

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 46 (35 by maintainers)

Commits related to this issue

Most upvoted comments

Closing. The good news is that in the process of figuring this one one we found 2 additional issues that needed to be resolved as well. 🥳

Definitely just a temporary workaround. It’s a private “playground” repo I’m using to figure out how to start using jreleaser for my other projects.

BTW, Thank you very much @aalmiray, for this amazing tool, it really looks and feels great.

I’ll post the trace.log next.

I’m working on a maven project. To get around this error, I’ve copied the content of both keys to the signing.publicKey and signing.secretKey in my pom.xml respectively.

This is OK as a temporary workaround but it’s certainly not recommended as it puts the keys in clear text. @tomerFI Could you do me a favor and post the stacktrace found at target/jreleaser/trace.log? Please edit out any private information that may be found.

I’ve setup locally using both environment variables and ~/.jreleaser/config.toml as the latter has better support for multi-line strings. The other format that supports multi-line is YAML. There are two additional options: JSON and properties however they require special handling of multi-line strings, for example:

JRELEASER_GPG_SECRET_KEY=-----BEGIN PGP PUBLIC KEY BLOCK-----\
\
abc...\

Basically each line must escape the break line. I don’t think this would make it work 100% though. For JSON you must us ea single line like this

{
  "JRELEASER_GPG_SECRET_KEY": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nabc..."
}

Works but it may be hard for edits. For this reason a new mode for dealing with PGP keys has been added #143

That is because the .yml extension is preferred over .yaml. Note the missing ‘a’ 😏