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.

Fix release validation draft metadata preservation

rcourtman54378a14e504
diff --git a/.github/workflows/validate-release-assets.yml b/.github/workflows/validate-release-assets.yml
index 828ac63cb8..fb1fd0f522 100644
--- a/.github/workflows/validate-release-assets.yml
+++ b/.github/workflows/validate-release-assets.yml
@@ -305,11 +305,26 @@ jobs:
$CURRENT_BODY"
- curl -X PATCH \
+ RELEASE_JSON=$(curl --fail-with-body --silent --show-error -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.context.outputs.release_id }}" \
- -d "$(jq -n --arg body "$NEW_BODY" '{body: $body}')"
+ -d "$(jq -n \
+ --arg body "$NEW_BODY" \
+ --arg tag "${{ steps.context.outputs.tag }}" \
+ --arg target_commitish "${{ steps.context.outputs.target_commitish }}" \
+ '{body: $body, tag_name: $tag, target_commitish: $target_commitish}')")
+
+ ACTUAL_RELEASE_TAG=$(echo "$RELEASE_JSON" | jq -r '.tag_name // empty')
+ ACTUAL_TARGET_COMMITISH=$(echo "$RELEASE_JSON" | jq -r '.target_commitish // empty')
+ if [ "$ACTUAL_RELEASE_TAG" != "${{ steps.context.outputs.tag }}" ]; then
+ echo "::error::Validation release body update detached release tag ${ACTUAL_RELEASE_TAG}; expected ${{ steps.context.outputs.tag }}."
+ exit 1
+ fi
+ if [ "$ACTUAL_TARGET_COMMITISH" != "${{ steps.context.outputs.target_commitish }}" ]; then
+ echo "::error::Validation release body update changed target_commitish ${ACTUAL_TARGET_COMMITISH}; expected ${{ steps.context.outputs.target_commitish }}."
+ exit 1
+ fi
- name: Set commit status - Failure
if: steps.context.outputs.should_run == 'true' && (failure() || steps.validate.outputs.validation_passed == 'false')
@@ -333,11 +348,24 @@ jobs:
INITIAL_STATE="${{ steps.context.outputs.draft }}"
if [ "$INITIAL_STATE" != "true" ]; then
echo "Release was published; reverting to draft before deleting assets..."
- curl -X PATCH \
+ RELEASE_JSON=$(curl --fail-with-body --silent --show-error -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.context.outputs.release_id }}" \
- -d '{"draft": true}'
+ -d "$(jq -n \
+ --arg tag "${{ steps.context.outputs.tag }}" \
+ --arg target_commitish "${{ steps.context.outputs.target_commitish }}" \
+ '{draft: true, tag_name: $tag, target_commitish: $target_commitish}')")
+ ACTUAL_RELEASE_TAG=$(echo "$RELEASE_JSON" | jq -r '.tag_name // empty')
+ ACTUAL_TARGET_COMMITISH=$(echo "$RELEASE_JSON" | jq -r '.target_commitish // empty')
+ if [ "$ACTUAL_RELEASE_TAG" != "${{ steps.context.outputs.tag }}" ]; then
+ echo "::error::Validation failure draft update detached release tag ${ACTUAL_RELEASE_TAG}; expected ${{ steps.context.outputs.tag }}."
+ exit 1
+ fi
+ if [ "$ACTUAL_TARGET_COMMITISH" != "${{ steps.context.outputs.target_commitish }}" ]; then
+ echo "::error::Validation failure draft update changed target_commitish ${ACTUAL_TARGET_COMMITISH}; expected ${{ steps.context.outputs.target_commitish }}."
+ exit 1
+ fi
echo "Release marked as draft to block downloads during remediation."
sleep 5
fi
@@ -434,11 +462,26 @@ jobs:
$CURRENT_BODY"
- curl -X PATCH \
+ RELEASE_JSON=$(curl --fail-with-body --silent --show-error -X PATCH \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.context.outputs.release_id }}" \
- -d "$(jq -n --arg body "$NEW_BODY" '{body: $body}')"
+ -d "$(jq -n \
+ --arg body "$NEW_BODY" \
+ --arg tag "${{ steps.context.outputs.tag }}" \
+ --arg target_commitish "${{ steps.context.outputs.target_commitish }}" \
+ '{body: $body, tag_name: $tag, target_commitish: $target_commitish}')")
+
+ ACTUAL_RELEASE_TAG=$(echo "$RELEASE_JSON" | jq -r '.tag_name // empty')
+ ACTUAL_TARGET_COMMITISH=$(echo "$RELEASE_JSON" | jq -r '.target_commitish // empty')
+ if [ "$ACTUAL_RELEASE_TAG" != "${{ steps.context.outputs.tag }}" ]; then
+ echo "::error::Validation failure body update detached release tag ${ACTUAL_RELEASE_TAG}; expected ${{ steps.context.outputs.tag }}."
+ exit 1
+ fi
+ if [ "$ACTUAL_TARGET_COMMITISH" != "${{ steps.context.outputs.target_commitish }}" ]; then
+ echo "::error::Validation failure body update changed target_commitish ${ACTUAL_TARGET_COMMITISH}; expected ${{ steps.context.outputs.target_commitish }}."
+ exit 1
+ fi
- name: Fail the workflow
if: steps.context.outputs.should_run == 'true' && (failure() || steps.validate.outputs.validation_passed == 'false')
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 7866e686f6..994ffc5381 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -450,6 +450,12 @@ That same reusable-validation call boundary also owns permission handoff.
`.github/workflows/validate-release-assets.yml` call the write scopes it
requests (`contents: write` and `issues: write`), rather than inheriting the
release pipeline's top-level read-only default and failing at workflow startup.
+That same validation status boundary must preserve release identity when it
+annotates a draft or failed release. Every release-body or draft-state PATCH
+from `.github/workflows/validate-release-assets.yml` must carry the intended
+`tag_name` and `target_commitish`, then verify the API response still matches
+those values, so validation status updates cannot detach a draft release back
+onto GitHub's generated `untagged-*` placeholder.
That same governed release boundary also owns unpublished draft retry
reconciliation. Re-running `.github/workflows/create-release.yml` for the same
unpublished tag must locate the existing draft release, retarget its git tag
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 6bf7e0494b..431ac7bc2e 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -165,6 +165,12 @@ func TestCreateReleaseUploadsPowerShellInstaller(t *testing.T) {
`statuses: write`,
`curl --fail-with-body --silent --show-error -X POST`,
`"context": "Release Asset Validation"`,
+ `--arg tag "${{ steps.context.outputs.tag }}"`,
+ `--arg target_commitish "${{ steps.context.outputs.target_commitish }}"`,
+ `{body: $body, tag_name: $tag, target_commitish: $target_commitish}`,
+ `{draft: true, tag_name: $tag, target_commitish: $target_commitish}`,
+ `Validation release body update detached release tag`,
+ `Validation release body update changed target_commitish`,
}
for _, needle := range validationRequired {
if !strings.Contains(validationWorkflow, needle) {
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index 6bd872ade5..a6ea7227e4 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -384,6 +384,12 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("statuses: write", validation_workflow)
self.assertIn("curl --fail-with-body --silent --show-error -X POST", validation_workflow)
self.assertIn('"context": "Release Asset Validation"', validation_workflow)
+ self.assertIn('--arg tag "${{ steps.context.outputs.tag }}"', validation_workflow)
+ self.assertIn('--arg target_commitish "${{ steps.context.outputs.target_commitish }}"', validation_workflow)
+ self.assertIn("{body: $body, tag_name: $tag, target_commitish: $target_commitish}", validation_workflow)
+ self.assertIn("{draft: true, tag_name: $tag, target_commitish: $target_commitish}", validation_workflow)
+ self.assertIn("Validation release body update detached release tag", validation_workflow)
+ self.assertIn("Validation release body update changed target_commitish", validation_workflow)
self.assertIn('ACTUAL_RELEASE_TAG=$(echo "$RELEASE_JSON" | jq -r \'.tag_name // empty\')', content)
self.assertIn(
'ACTUAL_TARGET_COMMITISH=$(echo "$RELEASE_JSON" | jq -r \'.target_commitish // empty\')',