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.

Reconcile draft release retries

rcourtmanef288b250b92
diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml
index 01284afcb4..9df88ef3bb 100644
--- a/.github/workflows/create-release.yml
+++ b/.github/workflows/create-release.yml
@@ -524,12 +524,32 @@ jobs:
echo "notes_file=${NOTES_FILE}" >> $GITHUB_OUTPUT
+ - name: Locate existing release
+ id: existing_release
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: |
+ TAG="${{ needs.prepare.outputs.tag }}"
+ EXISTING_RELEASE=$(gh api "repos/${{ github.repository }}/releases?per_page=100" --paginate | jq -sc --arg tag "$TAG" 'add | map(select(.tag_name == $tag)) | first // empty')
+ RELEASE_ID=$(echo "$EXISTING_RELEASE" | jq -r '.id // empty')
+ RELEASE_URL=$(echo "$EXISTING_RELEASE" | jq -r '.html_url // empty')
+ RELEASE_IS_DRAFT=$(echo "$EXISTING_RELEASE" | jq -r '.draft // false')
+ RELEASE_PUBLISHED_AT=$(echo "$EXISTING_RELEASE" | jq -r '.published_at // empty')
+
+ echo "release_id=${RELEASE_ID}" >> $GITHUB_OUTPUT
+ echo "release_url=${RELEASE_URL}" >> $GITHUB_OUTPUT
+ echo "release_is_draft=${RELEASE_IS_DRAFT}" >> $GITHUB_OUTPUT
+ echo "release_published_at=${RELEASE_PUBLISHED_AT}" >> $GITHUB_OUTPUT
+
- name: Create tag
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${{ needs.prepare.outputs.tag }}"
HEAD_SHA=$(git rev-parse HEAD)
+ EXISTING_RELEASE_ID="${{ steps.existing_release.outputs.release_id }}"
+ EXISTING_RELEASE_DRAFT="${{ steps.existing_release.outputs.release_is_draft }}"
+ EXISTING_RELEASE_PUBLISHED_AT="${{ steps.existing_release.outputs.release_published_at }}"
REMOTE_TAG_SHA=$(git ls-remote --tags origin "refs/tags/${TAG}" | awk '{print $1}')
@@ -539,6 +559,12 @@ jobs:
if [ "$REMOTE_COMMIT_SHA" = "$HEAD_SHA" ]; then
echo "Tag ${TAG} already exists and points to HEAD - continuing"
+ elif [ -n "$EXISTING_RELEASE_ID" ] && [ "$EXISTING_RELEASE_DRAFT" = "true" ] && [ -z "$EXISTING_RELEASE_PUBLISHED_AT" ]; then
+ echo "Retargeting existing draft tag ${TAG} from ${REMOTE_COMMIT_SHA} to ${HEAD_SHA}"
+ git config user.name "github-actions[bot]"
+ git config user.email "github-actions[bot]@users.noreply.github.com"
+ git tag -fa "${TAG}" -m "Release ${TAG}" "${HEAD_SHA}"
+ git push origin "refs/tags/${TAG}" --force
else
echo "::error::Tag ${TAG} already exists but points to ${REMOTE_COMMIT_SHA}, not HEAD (${HEAD_SHA}). Delete the tag first: git push origin --delete ${TAG}"
exit 1
@@ -559,19 +585,23 @@ jobs:
TAG="${{ needs.prepare.outputs.tag }}"
NOTES_FILE="${{ steps.generate_notes.outputs.notes_file }}"
IS_PRERELEASE="${{ needs.prepare.outputs.is_prerelease }}"
+ HEAD_SHA=$(git rev-parse HEAD)
- EXISTING_RELEASE=$(gh api "repos/${{ github.repository }}/releases/tags/${TAG}" 2>/dev/null || echo "")
- RELEASE_ID=$(echo "$EXISTING_RELEASE" | jq -r '.id // empty')
+ RELEASE_ID="${{ steps.existing_release.outputs.release_id }}"
+ RELEASE_URL="${{ steps.existing_release.outputs.release_url }}"
+ IS_DRAFT="${{ steps.existing_release.outputs.release_is_draft }}"
+ PUBLISHED_AT="${{ steps.existing_release.outputs.release_published_at }}"
if [ -n "$RELEASE_ID" ]; then
- RELEASE_URL=$(echo "$EXISTING_RELEASE" | jq -r '.html_url')
- IS_DRAFT=$(echo "$EXISTING_RELEASE" | jq -r '.draft')
-
- if [ "$IS_DRAFT" = "true" ]; then
+ if [ "$IS_DRAFT" = "true" ] && [ -z "$PUBLISHED_AT" ]; then
echo "Updating existing draft release for ${TAG}"
gh api "repos/${{ github.repository }}/releases/${RELEASE_ID}" \
-X PATCH \
- -F body="$(cat $NOTES_FILE)" \
+ -F tag_name="${TAG}" \
+ -F target_commitish="${HEAD_SHA}" \
+ -F name="Pulse ${TAG}" \
+ -F body="$(cat "$NOTES_FILE")" \
+ -F draft=true \
-F prerelease=${IS_PRERELEASE} > /dev/null
else
echo "::error::Published release already exists for ${TAG}."
@@ -582,8 +612,9 @@ jobs:
RELEASE_JSON=$(gh api "repos/${{ github.repository }}/releases" \
-X POST \
-F tag_name="${TAG}" \
+ -F target_commitish="${HEAD_SHA}" \
-F name="Pulse ${TAG}" \
- -F body="$(cat $NOTES_FILE)" \
+ -F body="$(cat "$NOTES_FILE")" \
-F draft=true \
-F prerelease=${IS_PRERELEASE})
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 8c6aec2df9..84cbb70f3b 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -186,6 +186,12 @@ state. When `.github/workflows/create-release.yml` runs in `draft_only` mode,
it must pass the real draft state into `.github/workflows/validate-release-assets.yml`
so validation blocks or annotates the draft release as a draft, rather than
misclassifying the run as post-publish revalidation.
+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
+and release `target_commitish` to the current governed release-line head, and
+continue publication without requiring an operator to delete the tag manually;
+published tags remain immutable and must still fail closed.
That same frontend-release boundary also owns shared header-composition proof.
`.github/workflows/release-dry-run.yml` and `.github/workflows/create-release.yml`
must both run the same `lint:headers` audit so a branch that would be rejected
diff --git a/docs/releases/V6_PRERELEASE_RUNBOOK.md b/docs/releases/V6_PRERELEASE_RUNBOOK.md
index 046ed527b0..e451425c1b 100644
--- a/docs/releases/V6_PRERELEASE_RUNBOOK.md
+++ b/docs/releases/V6_PRERELEASE_RUNBOOK.md
@@ -98,6 +98,9 @@ git push origin pulse/v6-release
- Re-run `Pulse Release Pipeline` on `pulse/v6-release`
- Same `version` and notes
- `draft_only`: `false`
+ - Existing unpublished draft releases for the same tag are updated in place
+ and their tag is retargeted to the current governed `pulse/v6-release`
+ head automatically. Do not delete the tag manually just to retry publish.
- The release workflow dispatches `update-demo-server.yml` against the
`preview-v6` demo target automatically.
- Keep the public stable demo on v5/stable; prereleases must land only on
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 30c3a731e1..f24bbabef5 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -65,6 +65,9 @@ func TestCreateReleaseUploadsPowerShellInstaller(t *testing.T) {
`gh release upload "${TAG}" release/install.sh --clobber`,
`if [ -f release/install.ps1 ]; then`,
`gh release upload "${TAG}" release/install.ps1 --clobber`,
+ `gh api "repos/${{ github.repository }}/releases?per_page=100" --paginate`,
+ `git push origin "refs/tags/${TAG}" --force`,
+ `-F target_commitish="${HEAD_SHA}"`,
}
for _, needle := range required {
if !strings.Contains(workflow, needle) {
diff --git a/scripts/release_control/release_promotion_policy_test.py b/scripts/release_control/release_promotion_policy_test.py
index d3f6ae0cb7..6be233ea1a 100644
--- a/scripts/release_control/release_promotion_policy_test.py
+++ b/scripts/release_control/release_promotion_policy_test.py
@@ -192,6 +192,10 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("ga_date", content)
self.assertIn("v5_eos_date", content)
self.assertIn("draft: ${{ github.event.inputs.draft_only == 'true' }}", content)
+ self.assertIn('gh api "repos/${{ github.repository }}/releases?per_page=100" --paginate', content)
+ self.assertIn('git push origin "refs/tags/${TAG}" --force', content)
+ self.assertIn('Retargeting existing draft tag ${TAG}', content)
+ self.assertIn('-F target_commitish="${HEAD_SHA}"', content)
self.assertIn("Derived rollback command:", helper)
self.assertIn("./scripts/install.sh --version", helper)
self.assertIn("v6 GA date to publish with GA", helper)
@@ -226,6 +230,7 @@ class ReleasePromotionPolicyTest(unittest.TestCase):
self.assertIn("pulse/v6-release", template)
self.assertIn("record_rc_to_ga_rehearsal.py --run-id <run-id>", runbook)
self.assertIn("rc-to-ga-promotion-readiness-rehearsal-<record-date>.md", runbook)
+ self.assertIn("Existing unpublished draft releases for the same tag are updated in place", runbook)
def test_release_artifact_workflows_refuse_stable_without_matching_rc(self) -> None:
publish = read(".github/workflows/publish-docker.yml")