在哪里可以保留jenkins在Windows上运行的GPG秘密密钥



我试图使用jenkins将我的工件释放到OSS Sonatype Nexus服务器。但是,尝试签署工件时会遇到以下错误。我已经生成了gpg键,并在我的Windows计算机上使用了C:/users/sara/appdata/roaming/gnupg文件夹。从另一个问题,可以在CI环境中保留Maven项目的GPG秘密密钥?我可以看到答案是针对基于UNIX的环境的。任何人都可以阐明在何处将詹金斯的秘密钥匙放在Windows环境中吗?

[INFO] --- maven-gpg-plugin:1.1:sign (sign-artifacts) @ StudentEnrollmentWithREST ---
    gpg: no default secret key: secret key not available
    gpg: signing failed: secret key not available
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1:27.647s
    [INFO] Finished at: Mon Jan 20 12:12:27 CST 2014
    [INFO] Final Memory: 22M/53M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.1:sign (sign-artifacts) on project StudentEnrollmentWithREST: Exit code: 2 -> [Help 1]
    [ERROR] 
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] 
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:45.118s
[INFO] Finished at: Mon Jan 20 12:12:33 CST 2014
[INFO] Final Memory: 8M/19M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project StudentEnrollmentWithREST: Maven execution failed, exit code: '1' -> [Help 1]
[JENKINS] Archiving C:Program Files (x86)JenkinsworkspaceUpload REST Release Artifactspom.xml to com.github.elizabetht/StudentEnrollmentWithREST/1.3-SNAPSHOT/StudentEnrollmentWithREST-1.3-SNAPSHOT.pom
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
channel stopped
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Finished: FAILURE

根据gpg:标志文档。
默认为~/.gnupg%APPDATA%/gnupg${gpg.homedir}应在您当前描述的文件夹中找到您的钥匙扣。默认情况下,名为pubring.gpgsecring.gpg的文件也可以配置。

也许问题是找到正确的密钥,除非另有配置,否则Maven使用"默认密钥"。钥匙扣中的第一个键是默认值。

选择一个键 - 这可能会在项目/父级或设置中,甚至在Commandline

中进行
<properties>
    <gpg.keyname>C78F3CC4</gpg.keyname>
</properties>

其他某些其他配置更可能是"每个主机",也许是您的设置中的配置文件。xml

<profile>
    <id>gpg-release</id>
    <properties>
        <gpg.passphrase>...</gpg.passphrase>
        <gpg.useagent>true</gpg.useagent>
<!--
        <gpg.defaultKeyring>false</gpg.defaultKeyring>
        <gpg.homedir>/private/.../.gnupg</gpg.homedir>
        <gpg.publicKeyring>/private/.../.gnupg/pubring.gpg</gpg.publicKeyring>
        <gpg.secretKeyring>/private/.../.gnupg/secring.gpg</gpg.secretKeyring>
-->
    </properties>
</profile>

如果您使用oss sonatype而不是在设置XML中使用命令行,则需要更多的体操。
来自OSS Sonatype文档。
由于Maven-Release-Plugin将启动一个新的Maven实例,因此-Dgpg.passphrase=PASSPHRASE在这种情况下无法使用,因此您应该使用 mvn release:perform -Darguments=-Dgpg.passphrase=PASSPHRASE[并在$ {garmuments}的项目POM使用中配置]

添加配置文件部分如下所示。xml工作

<profile> 
<id>gpg-release</id> 
<properties> 
<gpg.passphrase>password</gpg.passphrase> 
<gpg.useagent>true</gpg.useagent> 
<gpg.defaultKeyring>false</gpg.defaultKeyring> <gpg.homedir>C:/Users/User/AppData/Roaming/gnupg</gpg.homedir> <gpg.publicKeyring>C:/Users/User/AppData/Roaming/gnupg/pubring.gpg</gpg.publicKe‌​yring> <gpg.secretKeyring>C:/Users/User/AppData/Roaming/gnupg/secring.gpg</gpg.secre‌​tKeyring> </properties> 
</profile>

您可以在詹金斯/配置系统中的jenkins中保存gpg键。有一个RPM签名密钥部分,您可以在其中添加GPG密钥。在您应该在Jenkins中添加所需的插件

之前

最新更新