Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 32 additions & 3 deletions tools/releasing/release-passed.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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") <version>"
exit 1
fi

read -r -p "Version to publish [${RELEASE_VERSION}]: " answer
RELEASE_VERSION="${answer:-${RELEASE_VERSION}}"
fi
Expand All @@ -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
Expand Down
Loading