Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Recover Helm Pages from attested OCI charts

pulse-triage[bot]5e30bbb3468c
diff --git a/.github/workflows/helm-pages.yml b/.github/workflows/helm-pages.yml
index 07026efe35..6a8cb1423f 100644
--- a/.github/workflows/helm-pages.yml
+++ b/.github/workflows/helm-pages.yml
@@ -4,7 +4,9 @@ run-name: Release Helm Chart ${{ inputs.chart_version }}
# Called only from release-convergence.yml while it holds the global customer-
# promotion lease. Chart lint, packaging, OCI publication, and the exact-
# candidate install/upgrade smoke complete before activation. This workflow
-# verifies and promotes that immutable source-run artifact after activation.
+# recovers the digest-bound, attested OCI package and promotes the same package
+# after activation. Actions artifacts are deliberately not a recovery boundary:
+# they expire before an operator-owned convergence block necessarily clears.
on:
workflow_call:
inputs:
@@ -106,25 +108,12 @@ jobs:
python3 scripts/write_github_output.py version "${validated_version}"
python3 scripts/write_github_output.py release_tag "${release_tag}"
- - name: Download immutable qualified chart
- env:
- GH_TOKEN: ${{ github.token }}
- VERSION: ${{ steps.identity.outputs.version }}
- SOURCE_RELEASE_RUN_ID: ${{ inputs.source_release_run_id }}
- run: |
- set -euo pipefail
- mkdir -p dist
- gh run download "${SOURCE_RELEASE_RUN_ID}" \
- --repo "${{ github.repository }}" \
- --name "pulse-chart-${VERSION}" \
- --dir dist
-
- name: Set up Helm
uses: azure/setup-helm@dda3372f752e03dde6b3237bc9431cdc2f7a02a2 # v5.0.0
with:
version: v3.15.2
- - name: Verify immutable chart identity
+ - name: Recover immutable qualified chart
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.identity.outputs.version }}
@@ -134,13 +123,21 @@ jobs:
CHART_DIGEST: ${{ inputs.chart_digest }}
run: |
set -euo pipefail
+ mkdir -p dist
proof="$(./scripts/verify-release-helm-chart.sh \
"${RELEASE_TAG}" "${TARGET_COMMITISH}" \
- "${GITHUB_REPOSITORY}" "${CHART_DIGEST}")"
+ "${GITHUB_REPOSITORY}" "${CHART_DIGEST}" "${CHART_PATH}")"
if [ "${proof}" != "chart_digest=${CHART_DIGEST}" ]; then
echo "::error::Activated Helm OCI provenance did not produce the committed digest."
exit 1
fi
+
+ - name: Verify recovered chart metadata
+ env:
+ VERSION: ${{ steps.identity.outputs.version }}
+ CHART_PATH: dist/pulse-${{ steps.identity.outputs.version }}.tgz
+ run: |
+ set -euo pipefail
python3 - <<'PY'
import os
import pathlib
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 2f0a660b55..c16c0f3ab3 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -1082,10 +1082,12 @@ artifact-selection behaviour.
source-built and exact-candidate images must recreate and qualify all three;
otherwise the download handler rejects the local Windows agent and falls
through to a release asset with the wrong filename identity.
- Helm Pages convergence must promote the immutable chart artifact produced
- and qualified by the exact create-release run. It must bind that artifact
- to the activated source run, tag, commit, and activation marker, and must
- not repeat chart packaging or the pre-activation kind install/upgrade smoke.
+ Helm Pages convergence must recover the immutable chart package from the
+ OCI digest produced and qualified by the exact create-release run. It must
+ verify that digest's hosted-workflow provenance and bind the package to the
+ activated source run, tag, commit, and activation marker; a transient
+ Actions artifact is not a recovery boundary. It must not repeat chart
+ packaging or the pre-activation kind install/upgrade smoke.
Release-to-convergence and cross-repository child-run observation should
use short bounded polls so GitHub indexing cannot add tens of seconds after
a required exact run or activation marker has already completed.
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index ccc452c0fb..bb9523f391 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -2098,8 +2098,7 @@ func TestDeploymentDefaultsPinVersionedImagesAndHelmDocsChecksum(t *testing.T) {
`Require activated GitHub release and source run`,
`release-activation.json`,
`.github/workflows/create-release.yml`,
- `gh run download "${SOURCE_RELEASE_RUN_ID}"`,
- `--name "pulse-chart-${VERSION}"`,
+ `"${GITHUB_REPOSITORY}" "${CHART_DIGEST}" "${CHART_PATH}"`,
`qualified chart metadata does not match the activated release`,
`name: Publish chart release and merge Pages index`,
`gh release create "${chart_release}" "${chart_path}"`,
@@ -2116,6 +2115,7 @@ func TestDeploymentDefaultsPinVersionedImagesAndHelmDocsChecksum(t *testing.T) {
}
for _, forbidden := range []string{
"workflow_run:",
+ `gh run download "${SOURCE_RELEASE_RUN_ID}"`,
`Smoke test with kind`,
`Install helm-docs`,
`helm package deploy/helm/pulse`,
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index 793bc810e0..0bb2374302 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -2376,7 +2376,8 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("validate_artifact_release_line.py", helm)
self.assertIn(".github/workflows/create-release.yml", helm_pages)
self.assertIn("release-activation.json", helm_pages)
- self.assertIn('gh run download "${SOURCE_RELEASE_RUN_ID}"', helm_pages)
+ self.assertNotIn('gh run download "${SOURCE_RELEASE_RUN_ID}"', helm_pages)
+ self.assertIn('"${GITHUB_REPOSITORY}" "${CHART_DIGEST}" "${CHART_PATH}"', helm_pages)
self.assertIn("release_branch_for_version", artifact_validator)
self.assertIn("matching prerelease tag", artifact_validator)
self.assertIn("previous stable tag", artifact_validator)
@@ -2392,8 +2393,8 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn('qualified chart metadata does not match the activated release', helm_pages)
self.assertIn("workflow_call:", helm_pages)
self.assertNotIn("workflow_run:", helm_pages)
- self.assertIn('gh run download "${SOURCE_RELEASE_RUN_ID}"', helm_pages)
- self.assertIn('--name "pulse-chart-${VERSION}"', helm_pages)
+ self.assertNotIn('gh run download "${SOURCE_RELEASE_RUN_ID}"', helm_pages)
+ self.assertIn('"${GITHUB_REPOSITORY}" "${CHART_DIGEST}" "${CHART_PATH}"', helm_pages)
self.assertIn("release-activation.json", helm_pages)
self.assertIn(".github/workflows/create-release.yml", helm_pages)
self.assertNotIn('git pull --rebase origin "$REQUIRED_BRANCH"', helm_pages)
@@ -2430,7 +2431,7 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("verify-release-helm-chart.sh", helm_pages)
self.assertRegex(
helm_pages,
- r"(?s)- name: Verify immutable chart identity\n\s+env:\n\s+GH_TOKEN: \$\{\{ github\.token \}\}",
+ r"(?s)- name: Recover immutable qualified chart\n\s+env:\n\s+GH_TOKEN: \$\{\{ github\.token \}\}",
)
self.assertIn(
"chart_digest: ${{ needs.acquire_customer_promotion_lease.outputs.helm_chart_digest }}",
diff --git a/scripts/release_control/verify_release_helm_chart_test.py b/scripts/release_control/verify_release_helm_chart_test.py
index 3a260e1d82..7557559674 100644
--- a/scripts/release_control/verify_release_helm_chart_test.py
+++ b/scripts/release_control/verify_release_helm_chart_test.py
@@ -24,8 +24,9 @@ class VerifyReleaseHelmChartTests(unittest.TestCase):
expected_digest: str = "",
gh_exit: int = 0,
gh_version: str = "2.97.0",
+ output_chart: bool = False,
source_sha: str = SOURCE_SHA,
- ) -> tuple[subprocess.CompletedProcess[str], str]:
+ ) -> tuple[subprocess.CompletedProcess[str], str, bool]:
with tempfile.TemporaryDirectory() as temp:
temp_path = Path(temp)
bin_path = temp_path / "bin"
@@ -70,8 +71,11 @@ class VerifyReleaseHelmChartTests(unittest.TestCase):
}
)
args = [str(SCRIPT), "v6.4.1", source_sha, "rcourtman/Pulse"]
- if expected_digest:
+ if expected_digest or output_chart:
args.append(expected_digest)
+ output_path = temp_path / "recovered.tgz"
+ if output_chart:
+ args.append(str(output_path))
result = subprocess.run(
args,
cwd=ROOT,
@@ -80,10 +84,14 @@ class VerifyReleaseHelmChartTests(unittest.TestCase):
capture_output=True,
check=False,
)
- return result, gh_log.read_text(encoding="utf-8") if gh_log.exists() else ""
+ return (
+ result,
+ gh_log.read_text(encoding="utf-8") if gh_log.exists() else "",
+ output_path.is_file(),
+ )
def test_emits_digest_after_exact_hosted_provenance_verification(self) -> None:
- result, calls = self.run_verifier()
+ result, calls, _ = self.run_verifier()
self.assertEqual(result.returncode, 0, result.stderr)
self.assertEqual(result.stdout.strip(), f"chart_digest={DIGEST}")
@@ -100,33 +108,42 @@ class VerifyReleaseHelmChartTests(unittest.TestCase):
def test_rejects_a_chart_that_moved_after_activation(self) -> None:
expected = "sha256:" + "c" * 64
- result, calls = self.run_verifier(expected_digest=expected)
+ result, calls, _ = self.run_verifier(expected_digest=expected)
self.assertNotEqual(result.returncode, 0)
self.assertIn("Exact-version Helm chart moved", result.stderr)
self.assertEqual(calls, "")
def test_rejects_missing_or_malformed_registry_digest(self) -> None:
- result, calls = self.run_verifier(digest="unknown")
+ result, calls, _ = self.run_verifier(digest="unknown")
self.assertNotEqual(result.returncode, 0)
self.assertIn("did not report one exact OCI digest", result.stderr)
self.assertEqual(calls, "")
def test_rejects_unsafe_github_cli_before_registry_resolution(self) -> None:
- result, calls = self.run_verifier(gh_version="2.96.1")
+ result, calls, _ = self.run_verifier(gh_version="2.96.1")
self.assertNotEqual(result.returncode, 0)
self.assertIn("too old for release attestation policy enforcement", result.stderr)
self.assertEqual(calls, "")
def test_rejects_invalid_source_identity(self) -> None:
- result, calls = self.run_verifier(source_sha="main")
+ result, calls, _ = self.run_verifier(source_sha="main")
self.assertNotEqual(result.returncode, 0)
self.assertIn("Invalid release source SHA", result.stderr)
self.assertEqual(calls, "")
+ def test_preserves_the_verified_oci_package_for_promotion(self) -> None:
+ result, _, output_exists = self.run_verifier(
+ expected_digest=DIGEST,
+ output_chart=True,
+ )
+
+ self.assertEqual(result.returncode, 0, result.stderr)
+ self.assertTrue(output_exists)
+
if __name__ == "__main__":
unittest.main()
diff --git a/scripts/verify-release-helm-chart.sh b/scripts/verify-release-helm-chart.sh
index 635eec158e..83df3bbc51 100755
--- a/scripts/verify-release-helm-chart.sh
+++ b/scripts/verify-release-helm-chart.sh
@@ -2,12 +2,13 @@
# Resolve the exact-version OCI Helm chart to its registry digest and verify
# that GitHub's signed build provenance binds it to the release source and the
-# canonical hosted chart publisher.
+# canonical hosted chart publisher. When an output path is supplied, preserve
+# the exact OCI package whose digest and provenance passed those checks.
set -euo pipefail
-if [ "$#" -lt 2 ] || [ "$#" -gt 4 ]; then
- echo "Usage: $0 <tag> <source-sha> [owner/repo] [expected-digest]" >&2
+if [ "$#" -lt 2 ] || [ "$#" -gt 5 ]; then
+ echo "Usage: $0 <tag> <source-sha> [owner/repo] [expected-digest] [output-chart]" >&2
exit 2
fi
@@ -15,6 +16,7 @@ TAG="$1"
SOURCE_SHA="$2"
REPOSITORY="${3:-${GITHUB_REPOSITORY:-rcourtman/Pulse}}"
EXPECTED_DIGEST="${4:-}"
+OUTPUT_CHART="${5:-}"
OWNER="${REPOSITORY%%/*}"
VERSION="${TAG#v}"
SUBJECT="ghcr.io/${OWNER}/pulse-chart/pulse"
@@ -86,5 +88,18 @@ gh attestation verify "oci://${SUBJECT}@${chart_digest}" \
--predicate-type https://slsa.dev/provenance/v1 \
>/dev/null
+if [ -n "$OUTPUT_CHART" ]; then
+ resolved_chart="${pull_dir}/pulse-${VERSION}.tgz"
+ if [ ! -f "$resolved_chart" ] || [ -L "$resolved_chart" ]; then
+ echo "Verified OCI pull did not produce one regular chart package: ${resolved_chart}" >&2
+ exit 1
+ fi
+ if [ -L "$OUTPUT_CHART" ]; then
+ echo "Refusing to replace symlink output path: ${OUTPUT_CHART}" >&2
+ exit 1
+ fi
+ install -m 0644 -- "$resolved_chart" "$OUTPUT_CHART"
+fi
+
printf 'chart_digest=%s\n' "$chart_digest"
echo "[OK] Helm chart ${VERSION} and hosted build provenance resolve to ${chart_digest}." >&2