签署发行版时传递 gpg 密钥密码

Pass gpg key password when signing a release

我使用受密码保护的 gpg 密钥。 有没有办法将密码传递给底层 gpg 命令?

helm package --sign \
--key "my_key_name" \
--version "$VERSION" \
--app-version "$APP_VERSION" \
--keyring ~/.gnupg/secring.gpg my-chart

我尝试回显密码并通过管道传输,还尝试了 yes 命令,但这似乎不起作用。

当我做 echo "password" | helm package ... 我得到 Error: inappropriate ioctl for device

根据 helm 文档:

NOTE: If your PGP private key has a passphrase, you will be prompted to enter that passphrase for any commands that support the --sign option. You can set the HELM_KEY_PASSPHRASE environment variable to that passphrase in case you don't want to be prompted to enter the passphrase.

最后的命令是:

export HELM_KEY_PASSPHRASE=<password>
helm package --sign \
--key "my_key_name" \
--version "$VERSION" \
--app-version "$APP_VERSION" \
--keyring ~/.gnupg/secring.gpg my-chart