sbt / sbt-pgp

PGP plugin for sbt
Other
144 stars 56 forks source link

pgpSigningKey can't be found using credentials method #170

Open margussipria opened 5 years ago

margussipria commented 5 years ago

steps

sbt-pgp version: 2.0.0 sbt version: 1.3.3

problem

Using credentials how it is show README.md will not work.

When documentation part was copied from jodersky/sbt-gpg, also changes should have been done to that.

In this plugin gpg has been changed to pgp

https://github.com/sbt/sbt-pgp/blob/90465fcde014eb0688f0086fdec56db60ebfbfd6/sbt-pgp/src/main/scala/com/jsuereth/sbtpgp/PgpSettings.scala#L54

But changing this does not help, as this plugin is running that line before credential is added? I can see my key when running:

sbt:macros> show credentials
[info] * DirectCredentials("GnuPG Key ID", "pgp", "2BE67AC00D699E04E840B7FE29967E804D85663F", ****)

But can't see key when I run

sbt:macros> show pgpSigningKey
[info] None

I can use usePgpKeyHex method to add key, or add manually following line

pgpSigningKey := Credentials.forHost(credentials.value, "pgp").map(_.userName)

But that would be same if I would add key directly as

pgpSigningKey := Some("2BE67AC00D699E04E840B7FE29967E804D85663F")

expectation

  1. Documentation to be correct
  2. Signing key to be be loaded from credentials (plugin default value is resolved too early?)

notes

  1. I have tested moving credentials from project scope to global, didn't help with discovery.
  2. It would be nice to be able prefix host gpg for example with organization key. I have 2 keys that I use for signing different projects, those projects that could have multiple maintainers signing, it would be nice to have for work code one public configuration and every member has own private credentials file. For now I can have this option and also fix bug by having this line in public configuration
    pgpSigningKey := Credentials.forHost(credentials.value, s"${organization.value}-gpg").map(_.userName)