diff --git a/dev/create-release/release-build.sh b/dev/create-release/release-build.sh
index 45c359a66ae6a..46e08637e54fb 100755
--- a/dev/create-release/release-build.sh
+++ b/dev/create-release/release-build.sh
@@ -168,7 +168,12 @@ if [[ "$1" == "finalize" ]]; then
import re
release_version = "${RELEASE_VERSION}"
-newline = f'
Spark {release_version}'
+is_preview = bool(re.search(r'-preview\d*$', release_version))
+base_version = re.sub(r'-preview\d*$', '', release_version)
+
+stable_newline = f' Spark {release_version}'
+preview_newline = f' Spark {release_version} preview'
+
inserted = False
def parse_version(v):
@@ -183,29 +188,63 @@ with open("documentation.md") as f:
lines = f.readlines()
with open("documentation.md", "w") as f:
- for line in lines:
- match = re.search(r'docs/(\d+\.\d+\.\d+)/', line)
- if not inserted and match:
- existing_version = match.group(1)
- if vercmp(release_version, existing_version) >= 0:
- f.write(newline + "\n")
+ if is_preview:
+ in_preview_section = False
+ for i, line in enumerate(lines):
+ if 'Documentation for preview releases:
' in line:
+ in_preview_section = True
+ f.write(line)
+ continue
+
+ if in_preview_section and re.search(r'docs/\d+\.\d+\.\d+-preview\d*/', line):
+ existing_version = re.search(r'docs/(\d+\.\d+\.\d+-preview\d*)/', line).group(1)
+
+ if existing_version == release_version:
+ inserted = True # Already exists, don't add
+ elif not inserted:
+ base_existing = re.sub(r'-preview\d*$', '', existing_version)
+ preview_num_existing = int(re.search(r'preview(\d*)', existing_version).group(1) or "0")
+ preview_num_new = int(re.search(r'preview(\d*)', release_version).group(1) or "0")
+
+ if (vercmp(base_version, base_existing) > 0) or \
+ (vercmp(base_version, base_existing) == 0 and preview_num_new >= preview_num_existing):
+ f.write(preview_newline + "\n")
+ inserted = True
+
+ f.write(line)
+ continue
+
+ if in_preview_section and "" in line and not inserted:
+ f.write(preview_newline + "\n")
inserted = True
- f.write(line)
- if not inserted:
- f.write(newline + "\n")
+ f.write(line)
+ else:
+ for line in lines:
+ match = re.search(r'docs/(\d+\.\d+\.\d+)/', line)
+ if not inserted and match:
+ existing_version = match.group(1)
+ if vercmp(release_version, existing_version) >= 0:
+ f.write(stable_newline + "\n")
+ inserted = True
+ f.write(line)
+ if not inserted:
+ f.write(stable_newline + "\n")
EOF
echo "Edited documentation.md"
# 2. Add download link to js/downloads.js
- RELEASE_DATE=$(TZ=America/Los_Angeles date +"%m/%d/%Y")
- IFS='.' read -r rel_maj rel_min rel_patch <<< "$RELEASE_VERSION"
- NEW_PACKAGES="packagesV14"
- if [[ "$rel_maj" -ge 4 ]]; then
- NEW_PACKAGES="packagesV15"
- fi
+ if [[ "$RELEASE_VERSION" =~ -preview[0-9]*$ ]]; then
+ echo "Skipping js/downloads.js for preview release: $RELEASE_VERSION"
+ else
+ RELEASE_DATE=$(TZ=America/Los_Angeles date +"%m/%d/%Y")
+ IFS='.' read -r rel_maj rel_min rel_patch <<< "$RELEASE_VERSION"
+ NEW_PACKAGES="packagesV14"
+ if [[ "$rel_maj" -ge 4 ]]; then
+ NEW_PACKAGES="packagesV15"
+ fi
- python3 < "$FILENAME" < "$FILENAME" <Spark ${RELEASE_VERSION} release.
+This preview is not a stable release in terms of either API or functionality, but it is meant to give the community early
+access to try the code that will become Spark ${BASE_VERSION}. If you would like to test the release,
+please download it, and send feedback using either
+mailing lists or
+JIRA.
+The documentation is available at the link.
+
+We'd like to thank our contributors and users for their contributions and early feedback to this release. This release would not have been possible without you.
+EOF
+
+ else
+ cat > "$FILENAME" <Apache Spark ${RELEASE_VERSION}! Visit the release notes to read about the new features, or download the release today.
EOF
+ fi
echo "Created $FILENAME"
# 4. Add release notes with Python to extract JIRA version ID
- RELEASE_DATE=$(TZ=America/Los_Angeles date +"%Y-%m-%d")
- JIRA_PROJECT_ID=12315420
- JIRA_URL="https://issues.apache.org/jira/rest/api/2/project/SPARK/versions"
- JSON=$(curl -s "$JIRA_URL")
+ if [[ "$RELEASE_VERSION" =~ -preview[0-9]*$ ]]; then
+ echo "Skipping JIRA release notes for preview release: $RELEASE_VERSION"
+ else
+ RELEASE_DATE=$(TZ=America/Los_Angeles date +"%Y-%m-%d")
+ JIRA_PROJECT_ID=12315420
+ JIRA_URL="https://issues.apache.org/jira/rest/api/2/project/SPARK/versions"
+ JSON=$(curl -s "$JIRA_URL")
- VERSION_ID=$(python3 - <&2
- fi
+ if [[ -z "$VERSION_ID" ]]; then
+ echo "Error: Couldn't find JIRA version ID for $RELEASE_VERSION" >&2
+ fi
- JIRA_LINK="https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=${JIRA_PROJECT_ID}&version=${VERSION_ID}"
+ JIRA_LINK="https://issues.apache.org/jira/secure/ReleaseNote.jspa?projectId=${JIRA_PROJECT_ID}&version=${VERSION_ID}"
- IFS='.' read -r rel_maj rel_min rel_patch <<< "$RELEASE_VERSION"
- if [[ "$rel_patch" -eq 0 ]]; then
- ACKNOWLEDGE="patches and features to this release."
- BODY="Apache Spark ${RELEASE_VERSION} is a new feature release. It introduces new functionality and improvements. We encourage users to try it and provide feedback."
- else
- ACKNOWLEDGE="patches to this release."
- BODY="Apache Spark ${RELEASE_VERSION} is a maintenance release containing security and correctness fixes. This release is based on the branch-${rel_maj}.${rel_min} maintenance branch of Spark. We strongly recommend all ${rel_maj}.${rel_min} users to upgrade to this stable release."
- fi
+ IFS='.' read -r rel_maj rel_min rel_patch <<< "$RELEASE_VERSION"
+ if [[ "$rel_patch" -eq 0 ]]; then
+ ACKNOWLEDGE="patches and features to this release."
+ BODY="Apache Spark ${RELEASE_VERSION} is a new feature release. It introduces new functionality and improvements. We encourage users to try it and provide feedback."
+ else
+ ACKNOWLEDGE="patches to this release."
+ BODY="Apache Spark ${RELEASE_VERSION} is a maintenance release containing security and correctness fixes. This release is based on the branch-${rel_maj}.${rel_min} maintenance branch of Spark. We strongly recommend all ${rel_maj}.${rel_min} users to upgrade to this stable release."
+ fi
- BODY+="
+ BODY+="
You can find the list of resolved issues and detailed changes in the [JIRA release notes](${JIRA_LINK}).
We would like to acknowledge all community members for contributing ${ACKNOWLEDGE}"
- FILENAME="releases/_posts/${RELEASE_DATE}-spark-release-${RELEASE_VERSION}.md"
- mkdir -p releases/_posts
- cat > "$FILENAME" < "$FILENAME" < $RELEASE_VERSION (major version increased)"
- elif [[ "$rel_maj" -eq "$cur_maj" && "$rel_min" -gt "$cur_min" ]]; then
- ln -sfn "$RELEASE_VERSION" "$LINK_PATH"
- echo "Updated symlink $LINK_PATH -> $RELEASE_VERSION (minor version increased)"
+ ln -sfn "$RELEASE_VERSION" "$LINK_PATH"
+ echo "Updated symlink $LINK_PATH -> $RELEASE_VERSION (preview release)"
+
+ else
+ LINK_PATH="site/docs/latest"
+
+ if [[ "$rel_patch" -eq 0 ]]; then
+ if [[ -L "$LINK_PATH" ]]; then
+ CURRENT_TARGET=$(readlink "$LINK_PATH")
else
- echo "Symlink $LINK_PATH points to $CURRENT_TARGET with equal or newer major.minor, no change"
+ CURRENT_TARGET=""
+ fi
+
+ if [[ "$CURRENT_TARGET" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ IFS='.' read -r cur_maj cur_min cur_patch <<< "$CURRENT_TARGET"
+
+ if [[ "$rel_maj" -gt "$cur_maj" ]]; then
+ ln -sfn "$RELEASE_VERSION" "$LINK_PATH"
+ echo "Updated symlink $LINK_PATH -> $RELEASE_VERSION (major version increased)"
+ elif [[ "$rel_maj" -eq "$cur_maj" && "$rel_min" -gt "$cur_min" ]]; then
+ ln -sfn "$RELEASE_VERSION" "$LINK_PATH"
+ echo "Updated symlink $LINK_PATH -> $RELEASE_VERSION (minor version increased)"
+ else
+ echo "Symlink $LINK_PATH points to $CURRENT_TARGET with equal or newer major.minor, no change"
+ fi
+ else
+ echo "No valid existing version target."
fi
else
- echo "No valid existing version target."
+ echo "Patch release detected ($RELEASE_VERSION), not updating symlink"
fi
- else
- echo "Patch release detected ($RELEASE_VERSION), not updating symlink"
fi
git add .