From 3bac0c934bc4feb99628296ca563cb8be89828c6 Mon Sep 17 00:00:00 2001 From: Wu Sheng Date: Mon, 31 Aug 2026 15:44:15 +0800 Subject: [PATCH] Default release-passed.sh to the candidate that is actually in dist/dev Publishing 0.11.0 failed at step 2 with an svn path error. The prompt offered 0.12.0, and pressing Enter accepted it: the default came from Chart.yaml, which release.sh had already bumped through the next-version PR. So the better the release manager had followed the process, the more certainly the default was the wrong version. It reads dist/dev now -- the one place that knows what is waiting to be published -- refuses to guess when there is more than one candidate, and checks the chosen version exists before asking whether the vote passed, rather than failing several prompts later on a path that was never going to be there. --- docs/en/changes/changes.md | 1 + tools/releasing/release-passed.sh | 35 ++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md index fca9e770..54465a30 100644 --- a/docs/en/changes/changes.md +++ b/docs/en/changes/changes.md @@ -3,5 +3,6 @@ #### Features #### Bugs +- Take `release-passed.sh`'s default version from `dist/dev` rather than from `Chart.yaml`. By the time a vote passes, `release.sh` has already opened the next-version PR and it is usually merged, so `Chart.yaml` holds the version *after* the one being released -- pressing Enter at the prompt tried to publish a candidate that does not exist. It failed, but several prompts later and with an svn path error rather than an explanation. The script now reads what is actually waiting in `dist/dev`, refuses to guess when there is more than one candidate, and checks the chosen version exists before asking whether the vote passed. #### Chores diff --git a/tools/releasing/release-passed.sh b/tools/releasing/release-passed.sh index 178d777a..bd8f9acd 100755 --- a/tools/releasing/release-passed.sh +++ b/tools/releasing/release-passed.sh @@ -321,9 +321,30 @@ EOF RELEASE_VERSION="${1:-}" if [ -z "${RELEASE_VERSION}" ]; then - RELEASE_VERSION=$(awk '/^version:/{print $2; exit}' "${PROJECT_DIR}/chart/skywalking-swck/Chart.yaml") - echo "No version given; chart/skywalking-swck/Chart.yaml says ${RELEASE_VERSION}." - echo "NOTE: if the next-version PR has already merged, this is the NEXT version, not the one you released." + # Ask dist/dev what is waiting to be published, rather than the working tree. + # + # Chart.yaml is the wrong source here: by the time the vote passes, release.sh has already + # opened the next-version PR and it has usually been merged, so Chart.yaml holds the version + # AFTER the one being released. Defaulting to it meant pressing Enter tried to publish a + # candidate that does not exist -- which failed, but only several prompts later and with an + # svn path error rather than an explanation. + CANDIDATES=$(svn ls "${SVN_DEV_URL}" 2>/dev/null | tr -d '/' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' || true) + CANDIDATE_COUNT=$(echo "${CANDIDATES}" | grep -c . || true) + + if [ "${CANDIDATE_COUNT}" -eq 1 ]; then + RELEASE_VERSION="${CANDIDATES}" + echo "dist/dev holds one candidate: ${RELEASE_VERSION}" + elif [ "${CANDIDATE_COUNT}" -eq 0 ]; then + echo "ERROR: ${SVN_DEV_URL} holds no release candidate." + echo "Nothing has been uploaded for a vote, or it has already been published." + exit 1 + else + echo "ERROR: ${SVN_DEV_URL} holds more than one candidate:" + echo "${CANDIDATES}" | sed 's/^/ /' + echo "Pass the one you mean: bash $(basename "$0") " + exit 1 + fi + read -r -p "Version to publish [${RELEASE_VERSION}]: " answer RELEASE_VERSION="${answer:-${RELEASE_VERSION}}" fi @@ -333,6 +354,14 @@ if [[ ! "${RELEASE_VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then exit 1 fi +# Fail here, before the vote question and before anything is moved, rather than partway through +# with an svn path error. +if ! svn ls "${SVN_DEV_URL}/${RELEASE_VERSION}" >/dev/null 2>&1; then + echo "ERROR: ${SVN_DEV_URL}/${RELEASE_VERSION} does not exist." + echo "Available: $(svn ls "${SVN_DEV_URL}" 2>/dev/null | tr -d '/' | tr '\n' ' ')" + exit 1 +fi + echo "=== Step 1: Checking required tools ===" MISSING_TOOLS=() for tool in svn curl gh docker helm; do