Skip to content

Publish Helm plugin provenance artifacts in release pipeline#1006

Merged
yxxhero merged 9 commits into
masterfrom
copilot/add-provenance-artifacts-to-releases
Jun 6, 2026
Merged

Publish Helm plugin provenance artifacts in release pipeline#1006
yxxhero merged 9 commits into
masterfrom
copilot/add-provenance-artifacts-to-releases

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

Helm v4 verifies plugin provenance by default, but this repo only published .tgz plugin archives, causing installs to fail unless verification was explicitly disabled. This PR adds signed .prov artifacts to releases and updates install guidance accordingly.

Changes

Release artifact signing (.goreleaser.yml)

  • Added a signs block for archive artifacts.
  • Generates Helm-compatible provenance files as ${artifact}.prov.
  • Signs a provenance message containing plugin.yaml metadata + files:<archive>=sha256:<digest> using GPG (clear-signed output Helm can verify).
  • Passphrase provided via temp file (--passphrase-file) instead of CLI arg to avoid /proc leakage.
  • Added GPG_FINGERPRINT guard with clear error message on misconfiguration.

Release workflow (.github/workflows/release.yaml)

  • Imports the release signing key for tagged releases only.
  • GPG_FINGERPRINT and GPG_PASSPHRASE are set via a conditional step gated on startsWith(github.ref, 'refs/tags/v'), so non-tag/snapshot/PR runs never see these secrets.
  • Skips signing during snapshot/non-tag runs (--skip=sign).
  • gpgconf --launch gpg-agent ensures the GPG agent is ready before key import.
  • Added provenance-smoke-test job that validates the signing script with a disposable GPG key on PR/push runs (no secrets needed).
  • Added workflow_dispatch trigger for manual testing.
  • Header comment documents required secrets and key rotation procedure.

Docs update (README.md)

  • Removed the Helm 4 --verify=false workaround instruction.
  • Added public key import instructions (gpg --keyserver keys.openpgp.org --recv-keys <FINGERPRINT>).
  • Notes that the key fingerprint is published in each GitHub release notes.

Prerequisites

Before the first tagged release, configure these repository secrets (Settings > Secrets and variables > Actions):

  • GPG_PRIVATE_KEY — base64-encoded GPG private key
  • GPG_FINGERPRINT — Fingerprint of the GPG key
  • GPG_PASSPHRASE — Passphrase for the GPG private key

Closes

Closes #1005

Copilot AI linked an issue Jun 5, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add provenance artifacts to releases Publish Helm plugin provenance artifacts in release pipeline Jun 5, 2026
Copilot AI requested a review from yxxhero June 5, 2026 10:27
@yxxhero yxxhero requested review from Copilot and mumoshu June 6, 2026 01:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the release pipeline to publish Helm v4-compatible provenance (.prov) artifacts for the plugin archives so Helm installs can succeed with default verification enabled.

Changes:

  • Added a GoReleaser signing step to generate clear-signed ${archive}.prov provenance files for each published .tgz.
  • Updated the GitHub Actions release workflow to import the GPG key on tag releases and skip signing for snapshot runs.
  • Updated README guidance to remove the Helm 4 --verify=false workaround and describe provenance availability.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
README.md Updates Helm 4 installation guidance to reflect published provenance artifacts.
.goreleaser.yml Adds signing logic to generate Helm-compatible .prov files for archive artifacts.
.github/workflows/release.yaml Wires GPG key import/secrets and adjusts snapshot flags to skip signing.

Comment thread .goreleaser.yml Outdated
Comment on lines +68 to +72
{
cat plugin.yaml
printf '\n...\n'
printf 'files:\n %s: "sha256:%s"\n' "$filename" "$digest"
} | gpg --batch --yes --armor --pinentry-mode loopback --passphrase "${GPG_PASSPHRASE:-}" --local-user "$GPG_FINGERPRINT" --clearsign --output "$signature"
Comment thread .github/workflows/release.yaml Outdated
Comment on lines +46 to +49
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
@yxxhero
Copy link
Copy Markdown
Collaborator

yxxhero commented Jun 6, 2026

@copilot fix ci isssue and comments.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 6, 2026

@copilot fix ci isssue and comments.

Fixed both issues in commit Fix GPG secret handling: use passphrase-file and restrict secrets to tag runs:

  1. .goreleaser.yml – Replaced --passphrase "..." CLI arg with a mktemp-based passphrase file (--passphrase-file), cleaned up via trap. The passphrase is no longer visible in process listings.

  2. .github/workflows/release.yaml – Moved GPG_FINGERPRINT and GPG_PASSPHRASE out of the GoReleaser step's env: block into a conditional "Set GPG environment for signing" step that only runs on tagged releases (startsWith(github.ref, 'refs/tags/v')). Non-tag/snapshot runs no longer have access to these secrets.

@yxxhero yxxhero marked this pull request as ready for review June 6, 2026 03:14
@yxxhero yxxhero requested a review from Copilot June 6, 2026 03:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

README.md:50

  • The linked HIP at hips/hip-0026.md is titled "H4HIP: Wasm plugin system", not plugin provenance. The link target may be correct, but the link text is currently inaccurate/misleading for readers looking for provenance documentation.
Helm 4 verifies plugin provenance by default. This project publishes release provenance artifacts (`.prov`) alongside release tarballs to support verification.

For more information about Helm 4's plugin verification, see:
- [Helm 4 Overview](https://helm.sh/docs/overview)
- [HIP-0026: Plugin Provenance](https://github.com/helm/community/blob/main/hips/hip-0026.md)

Comment thread .goreleaser.yml Outdated
chmod 600 "$passphrase_file"
{
cat plugin.yaml
printf '\n...\n'
- Add gpgconf --launch gpg-agent before GPG key import in CI
- Fix provenance separator format to match Helm parser (\n...\n -> ...\n)
- Add provenance-smoke-test job that validates signing with disposable key
- Add workflow_dispatch trigger for manual testing
- Document required GPG secrets and key rotation in workflow header
- Update README with public key import guidance for Helm 4 users

Signed-off-by: yxxhero <aiopsclub@163.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

Comment thread README.md Outdated
```shell
helm plugin install https://github.com/databus23/helm-diff --verify=false
```
Helm 4 verifies plugin provenance by default. This project publishes GPG-signed provenance artifacts (`.prov`) alongside release tarballs. To verify, import the project's public key into your keyring before running `helm plugin install`.
Comment thread .goreleaser.yml Outdated
Comment on lines +64 to +67
artifact="$1"
signature="$2"
filename="$(basename "$artifact")"
digest="$(sha256sum "$artifact" | cut -d' ' -f1)"
Comment thread .github/workflows/release.yaml Outdated
Comment on lines +10 to +11
# - To rotate: generate a new keypair, update all three secrets, and verify
# with a test release (see the test-provenance-sign-dry job)
Comment thread .github/workflows/release.yaml Outdated
filename="$(basename "$artifact")"
digest="$(sha256sum "$artifact" | cut -d' ' -f1)"
passphrase_file="$(mktemp)"
trap 'rm -f "$passphrase_file"' EXIT
- Add GPG_FINGERPRINT guard with clear error message
- Add public key download instructions and fingerprint note to README
- Fix header comment referencing provenance-smoke-test job name
- Fix double trap overwriting GNUPGHOME cleanup in smoke test
- Consolidate cleanup into single trap statement

Signed-off-by: yxxhero <aiopsclub@163.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

Comment thread .goreleaser.yml Outdated
Comment on lines +76 to +80
{
cat plugin.yaml
printf '...\n'
printf 'files:\n %s: "sha256:%s"\n' "$filename" "$digest"
} | gpg --batch --yes --armor --pinentry-mode loopback --passphrase-file "$passphrase_file" --local-user "$GPG_FINGERPRINT" --clearsign --output "$signature"
Comment thread .github/workflows/release.yaml Outdated
Comment on lines +52 to +53
gpgconf --launch gpg-agent
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --batch --import
Comment thread .github/workflows/release.yaml Outdated
Comment on lines +86 to +89
GPG_FINGERPRINT=$(gpg --batch --passphrase '' --quick-generate-key \
"helm-diff-test" ed25519 sign 0 2>&1 \
| grep -o '[A-F0-9]\{40\}' | head -1)
export GPG_FINGERPRINT
Comment thread .github/workflows/release.yaml Outdated
Comment on lines +101 to +105
{
cat plugin.yaml
printf '...\n'
printf 'files:\n %s: "sha256:%s"\n' "$filename" "$digest"
} | gpg --batch --yes --armor --pinentry-mode loopback \
Comment thread README.md Outdated

```shell
helm plugin install https://github.com/databus23/helm-diff --verify=false
gpg --keyserver keys.openpgp.org --recv-keys <KEY_FINGERPRINT>
- Use printf instead of echo for GPG key import to avoid corruption
- Use --with-colons --list-secret-keys for reliable fingerprint extraction
- Use HKPS keyserver URL in README for TLS-protected key fetch

Signed-off-by: yxxhero <aiopsclub@163.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

Comment thread README.md Outdated
helm plugin install https://github.com/databus23/helm-diff
```

The public key fingerprint is published in each GitHub release notes.
Comment thread .goreleaser.yml Outdated
artifact="$1"
signature="$2"
filename="$(basename "$artifact")"
digest="$(sha256sum "$artifact" | cut -d' ' -f1)"
Comment thread .github/workflows/release.yaml Outdated
Comment on lines +96 to +106
artifact="$tmpdir/helm-diff-linux-amd64.tgz"
signature="${artifact}.prov"
filename="$(basename "$artifact")"
digest="$(sha256sum "$artifact" | cut -d' ' -f1)"
printf '%s' "${GPG_PASSPHRASE:-}" > "$passphrase_file"
chmod 600 "$passphrase_file"
{
cat plugin.yaml
printf '...\n'
printf 'files:\n %s: "sha256:%s"\n' "$filename" "$digest"
} | gpg --batch --yes --armor --pinentry-mode loopback \
- Extract provenance signing to scripts/sign-provenance.sh (used by both
  goreleaser and smoke test) to prevent logic drift
- Add sha256sum fallback to shasum for macOS compatibility
- Fix grammar in README key fingerprint sentence

Signed-off-by: yxxhero <aiopsclub@163.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread .goreleaser.yml
Comment thread README.md
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment on lines +26 to +29
{
cat "$plugin_yaml"
printf '...\n'
printf 'files:\n %s: "sha256:%s"\n' "$filename" "$digest"
Signed-off-by: yxxhero <aiopsclub@163.com>
@yxxhero yxxhero merged commit 50d704b into master Jun 6, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Provenance artifacts to releases

3 participants