Skip to content

Conversation

JonasVautherin
Copy link
Contributor

@JonasVautherin JonasVautherin commented Jun 1, 2025

Fixes #1883

Context

GPG private keys are not always protected by a passphrase. Jreleaser should support unprotected keys.

Testing

I tried it both with a passphrase-protected key and an unprotected key, and it works for me.

Checklist

@JonasVautherin JonasVautherin requested a review from aalmiray as a code owner June 1, 2025 21:55
@CLAassistant
Copy link

CLAassistant commented Jun 1, 2025

CLA assistant check
All committers have signed the CLA.

@JonasVautherin JonasVautherin force-pushed the 1883-gpg-blank-passphrase branch from 293a79e to 147b7c8 Compare June 1, 2025 21:58
@JonasVautherin JonasVautherin changed the title Add support for blank gpg passphrase fix(gradle): add support for blank gpg passphrase Jun 1, 2025
JonasVautherin added a commit to JonasVautherin/jreleaser.github.io that referenced this pull request Jun 1, 2025
Update documentation following jreleaser/jreleaser#1884
@JonasVautherin JonasVautherin reopened this Jun 1, 2025
cosign ? COSIGN_PASSWORD : GPG_PASSPHRASE,
"signing.passphrase",
signing.getPassphrase(),
new Errors(),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to minimise my changes. I pass new Errors() here as a way to ignore the errors (otherwise it just fails).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, passing a new instance of Errors is the way to go. You could change the logic to always pass a new instance no matter what.

Also, the warning should be already resolved from internal message resources.

Given that the errors instance is new, if the passphrase is blank there should be a single error message. You could grab it and print it as a warning.

Copy link
Contributor Author

@JonasVautherin JonasVautherin Jun 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if I print the error as a warning, it says this:

[WARN]    [validation] signing.passphrase must not be blank. Configure a value using the Gradle DSL, or define a System property jreleaser.gpg.passphrase, or define a JRELEASER_GPG_PASSPHRASE environment variable, or define a key/value pair in /home/jones/.jreleaser/config.properties with a key named JRELEASER_GPG_PASSPHRASE

Which works, but it feels a bit weird because signing.passphrase can actually be blank, right? This is why I was thinking of logging "[WARN] Passphrase is blank" instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, right. Then please add a message resource for the new warning message stating that the passphrase is blank. And if one should be supplies then use the suggested env vars or sys props.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! What do you think? 😊

@@ -160,6 +160,7 @@ signing.file.newer = {} is newer than {}
signing.check.published.key = Checking if key {} has been published
signing.key.published = Key {} was found as published
signing.key.not.published = Key {} was NOT found as published
signing.passphrase.blank = Passphrase is blank. In case a passphrase is needed, you can configure a value using the Gradle DSL, or define a System property {}, or define a {} environment variable, or define a key/value pair in {} with a key named {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Gradle DSL is not the only one. There should be another message key in the resources file that can be used as a guide.

"signing.passphrase",
signing.getPassphrase(),
new Errors(),
context.isDryrun());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last parameter can be explicitly set to false.

@JonasVautherin JonasVautherin force-pushed the 1883-gpg-blank-passphrase branch from 9cdd537 to 1100aa0 Compare June 2, 2025 21:09
@aalmiray aalmiray merged commit e9deaf8 into jreleaser:main Jun 3, 2025
9 checks passed
@aalmiray
Copy link
Member

aalmiray commented Jun 3, 2025

Thank you 😄

aalmiray pushed a commit to jreleaser/jreleaser.github.io that referenced this pull request Jun 3, 2025
Update documentation following jreleaser/jreleaser#1884
@JonasVautherin
Copy link
Contributor Author

And thank you for the guidance! And I see that it's already released in early-access 🎉.

Out of curiosity, what is the process to get it to Maven Central? Just to have an idea about when I could expect to see it there?

@aalmiray
Copy link
Member

aalmiray commented Jun 3, 2025

Releases to Maven Central are posted every two months, at the end of the month, on even months. The next release is scheduled for June 30th.

Per our release cadence #873

aalmiray pushed a commit to jreleaser/jreleaser.github.io that referenced this pull request Jun 6, 2025
Update documentation following jreleaser/jreleaser#1884
@aalmiray aalmiray added the released Issue has been released label Jun 30, 2025
@aalmiray
Copy link
Member

🎉 This issue has been resolved in v1.19.0 (Release Notes)

@aalmiray aalmiray added this to the v1.19.0 milestone Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released Issue has been released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] signing.passphrase must not be blank.
3 participants