【问题标题】:How to solve a Secret file bindings issue如何解决秘密文件绑定问题
【发布时间】:2015-08-13 21:49:32
【问题描述】:

我的一个 jenkins 版本有问题。

我已经在我的全局凭据中配置了一个 keystore 用于我的一个 android 版本。例如,当我必须签署我的 apk 以便在 Google Play 上分发我的应用程序时,需要此密钥库。

所以在工作中,我配置了一个 秘密文件绑定 以允许 jenkins 将密钥库文件复制到一个临时位置并设置一个变量,我们称之为 SECRET_PATH,到该位置。然后,当调用 gradle 脚本(在开关部分)时,我可以在命令行上为 gradle 提供此变量的值。

但是每次构建都会失败:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':myapp:packageRelease'.
> Failed to read key ******** from store "/home/jenkins/slave/secretFiles/3607aab3-6e27-497a-b198-7d9a3aeb2913/keystore": Keystore was tampered with, or password was incorrect

就好像位置 /home/jenkins/slave/secretFiles/3607aab3-6e27-497a-b198-7d9a3aeb2913/keystore 根本不存在。

在作业配置中,绑定部分的帮助提示也提到了这一点:

Warning: if the master or slave node has multiple executors, any other build running concurrently on the same node will be able to read the contents of this file.

就好像另一个并发构建正在运行并删除了密钥库所在的位置。这真的很奇怪。

还有一件事,我使用的是主/从拓扑,其中所有内容都被 dockerized。不确定码头工人本身是否参与其中。我认为这纯粹是 Jenkins 的问题,但我提供这些信息是为了让你们了解一些背景信息。

你们有没有遇到过这种奇怪的行为,jenkins 似乎无法“解决”秘密文件绑定? 任何帮助将不胜感激。

提前致谢,

【问题讨论】:

    标签: android jenkins binding gradle continuous-integration


    【解决方案1】:

    Failed to read key ******** from store "/home/jenkins/slave/secretFiles/3607aab3-6e27-497a-b198-7d9a3aeb2913/keystore": Keystore was tampered with, or password was incorrect

    就好像/.../keystore 的位置根本不存在。

    不,错误消息是正确的 - 文件确实存在,但很可能您提供的商店密码或密钥密码不正确。

    如果密钥库存在,您会收到类似以下的错误:
    File '/.../release.keystore' specified for property 'signingConfig.storeFile' does not exist.

    您可以通过运行 file $SECRET_PATH/keystorels -l $SECRET_PATH/keystore 或使用 keytool 或类似的东西来仔细检查。


    你根本没有提到将密钥库和密钥密码注入到工作中——你是怎么做到的?

    首先确保在命令行中使用 Gradle 构建和签名发布版本按预期工作。

    然后你可以尝试在 Jenkins 中做同样的事情,通过 Gradle 步骤传递文件名和密码(尽管如果你使用 Job Config History 插件,这不是一个好主意,例如)。

    一旦成功,您就可以使用凭据绑定插件来注入文件,并注入密码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-08
      • 2011-08-01
      • 1970-01-01
      相关资源
      最近更新 更多