diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index d62666dbe9..538527bdf5 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -84,8 +84,6 @@ jobs: DRY_RUN: ${{ inputs.dry_run && '1' || '0' }} NEXUS_USERNAME: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} NEXUS_PASSWORD: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} - SVN_USERNAME: ${{ secrets.PARQUET_SVN_DEV_USERNAME }} - SVN_PASSWORD: ${{ secrets.PARQUET_SVN_DEV_PASSWORD }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} INPUT_VERSION: ${{ inputs.version }} INPUT_RC_NUMBER: ${{ inputs.rc_number }} diff --git a/release/bin/publish-release.sh b/release/bin/publish-release.sh index 99207c0dd4..5be8d68f87 100755 --- a/release/bin/publish-release.sh +++ b/release/bin/publish-release.sh @@ -61,8 +61,6 @@ Environment variables: DRY_RUN Set to 0 for real execution (default: 1) NEXUS_USERNAME Apache Nexus username NEXUS_PASSWORD Apache Nexus password - SVN_USERNAME SVN username for dist.apache.org - SVN_PASSWORD SVN password GITHUB_TOKEN GitHub token for release creation Example: @@ -129,7 +127,7 @@ if [[ ${DRY_RUN:-1} -eq 1 ]]; then fi if [[ ${DRY_RUN:-1} -ne 1 ]]; then - if ! require_env NEXUS_USERNAME NEXUS_PASSWORD SVN_USERNAME SVN_PASSWORD; then + if ! require_env NEXUS_USERNAME NEXUS_PASSWORD; then exit 1 fi fi @@ -224,57 +222,17 @@ fi step_summary "Staging repository \`${staging_repo_id}\` verified" # --------------------------------------------------------------------------- -# Step 1: Move SVN artifacts from dist/dev to dist/release -# --------------------------------------------------------------------------- -step_summary "" -step_summary "### SVN Promotion" - -svn_promote_rc_to_release "${version}" "${rc_num}" - -step_summary "Promoted \`${rc_tag}\` -> \`${final_tag}\` on dist.apache.org" - -# --------------------------------------------------------------------------- -# Step 2: Clean up superseded patch releases on the same minor branch -# --------------------------------------------------------------------------- -# Policy: only patch releases of the *same* minor (parquet-${major}.${minor}.x) -# that are older than ${version} are removed from dist/release/parquet/. -# Releases on other minor branches are left in place and must be retired -# manually. See svn_list_old_releases for the full rationale. -step_summary "" -step_summary "### Patch Release Cleanup (parquet-${major}.${minor}.x)" - -if [[ ${DRY_RUN:-1} -ne 1 ]]; then - if ! old_versions=$(svn_list_old_releases "${version}"); then - exit 1 - fi - - if [[ -n "${old_versions}" ]]; then - step_summary "Removing superseded patches on parquet-${major}.${minor}.x:" - while IFS= read -r old_dir; do - [[ -z "${old_dir}" ]] && continue - svn_remove_release "${old_dir}" "${version}" - step_summary "- Removed \`${old_dir}\`" - done <<< "${old_versions}" - else - step_summary "No superseded ${major}.${minor}.x patches to clean up" - fi -else - print_command "Dry-run, WOULD remove superseded ${major}.${minor}.x patches from dist/release" - step_summary "Would remove superseded ${major}.${minor}.x patches (dry-run)" -fi - -# --------------------------------------------------------------------------- -# Step 3: Create final release tag locally (pushed in step 5) +# Step 1: Create final release tag locally (pushed in step 3) # --------------------------------------------------------------------------- step_summary "" step_summary "### Release Tag" exec_process git tag -a "${final_tag}" "${rc_commit}" -m "Release Apache Parquet ${version}" -step_summary "Created tag \`${final_tag}\` at \`${rc_commit}\` (pushed in step 5)" +step_summary "Created tag \`${final_tag}\` at \`${rc_commit}\` (pushed in step 3)" # --------------------------------------------------------------------------- -# Step 4: Release Nexus staging repo +# Step 2: Release Nexus staging repo # --------------------------------------------------------------------------- step_summary "" step_summary "### Nexus Release" @@ -284,13 +242,13 @@ nexus_release_staging_repo "${staging_repo_id}" "Apache Parquet ${version}" step_summary "Released staging repository \`${staging_repo_id}\` to Maven Central" # --------------------------------------------------------------------------- -# Step 5: Push the release tag and create the GitHub Release +# Step 3: Push the release tag and create the GitHub Release # --------------------------------------------------------------------------- step_summary "" step_summary "### Tag Push" -# Pushed here rather than with the tag creation in step 3: a Nexus failure in -# step 4 would otherwise leave a published release tag, and the +# Pushed here rather than with the tag creation in step 1: a Nexus failure in +# step 2 would otherwise leave a published release tag, and the # "Final release tag already exists" guard then blocks the retry. exec_process git push origin "${final_tag}" step_summary "Pushed tag \`${final_tag}\`" @@ -317,7 +275,7 @@ else fi # --------------------------------------------------------------------------- -# Step 6: Bump to next development version +# Step 4: Bump to next development version # --------------------------------------------------------------------------- step_summary "" step_summary "### Version Bump" @@ -360,7 +318,7 @@ exec_process git push origin HEAD step_summary "Bumped version to \`${next_snapshot}\` on branch \`${current_branch}\`, set \`previous.version=${version}\`" # --------------------------------------------------------------------------- -# Step 7: Generate announce email +# Step 5: Generate announce email # --------------------------------------------------------------------------- step_summary "" step_summary "### Announce Email" @@ -384,7 +342,49 @@ step_summary "Thanks to everyone for contributing!" step_summary '```' # --------------------------------------------------------------------------- -# Step 8: Reminder -- update parquet.apache.org +# Step 6: Reminder -- promote artifacts on dist.apache.org +# --------------------------------------------------------------------------- +# The CI SVN credentials can only write to dist/dev; a PMC member has to +# move the artifacts into dist/release, so print the exact commands. +dist_dev_url="${APACHE_DIST_URL}${APACHE_DIST_DEV_PATH}" +dist_release_url="${APACHE_DIST_URL}${APACHE_DIST_RELEASE_PATH}" + +old_versions_listed=1 +if ! old_versions=$(svn_list_old_releases "${version}"); then + old_versions_listed=0 + old_versions="" + print_warning "Could not list ${dist_release_url}; the summary will ask for the old releases to be found by hand" +fi + +step_summary "" +step_summary "### Manual Follow-up (PMC): Promote Artifacts on dist.apache.org" +step_summary "" +step_summary "The release artifacts remain in dist dev. A PMC member must run:" +step_summary "" +step_summary '```bash' +step_summary "svn mv ${dist_dev_url}/${rc_tag} \\" +step_summary " ${dist_release_url}/${final_tag} \\" +step_summary " -m \"Release Apache Parquet ${version}\"" +while IFS= read -r old_dir; do + [[ -z "${old_dir}" ]] && continue + step_summary "svn rm ${dist_release_url}/${old_dir} \\" + step_summary " -m \"Remove old release ${old_dir} (superseded by ${version})\"" +done <<< "${old_versions}" +step_summary '```' +step_summary "" +if [[ ${old_versions_listed} -eq 0 ]]; then + step_summary "> **Could not list \`${dist_release_url}\`.** Also \`svn rm\` any older" + step_summary "> \`${TAG_PREFIX}${major}.${minor}.*\` patch releases superseded by \`${version}\`." +elif [[ -z "${old_versions}" ]]; then + step_summary "No superseded ${major}.${minor}.x patch releases to remove." +else + step_summary "The \`svn rm\` lines remove superseded ${major}.${minor}.x patch releases." +fi +step_summary "" +step_summary "Releases on other minor branches are left in place." + +# --------------------------------------------------------------------------- +# Step 7: Reminder -- update parquet.apache.org # --------------------------------------------------------------------------- release_date=$(date +%Y-%m-%d) step_summary "" @@ -424,13 +424,13 @@ step_summary "### Summary" step_summary "" step_summary "| Step | Status |" step_summary "| --- | --- |" -step_summary "| SVN promotion | done |" -step_summary "| Old release cleanup | done |" step_summary "| Final release tag | \`${final_tag}\` |" step_summary "| Nexus release | \`${staging_repo_id}\` released |" step_summary "| GitHub release | created |" step_summary "| Version bump | \`${next_snapshot}\` |" step_summary "| Announce email | generated |" +step_summary "| dist.apache.org promotion | **manual (PMC)** -- see commands above |" +step_summary "| Old release cleanup | **manual (PMC)** -- see commands above |" step_summary "| Site update | **manual** -- see template above |" print_success "Release ${version} published successfully!" diff --git a/release/libs/_svn.sh b/release/libs/_svn.sh index 9faad854bf..9ecafb2309 100644 --- a/release/libs/_svn.sh +++ b/release/libs/_svn.sh @@ -81,23 +81,6 @@ function svn_stage_rc { -m "${commit_msg}" ) } -# svn_promote_rc_to_release -# Moves dist/dev/parquet// to dist/release/parquet//. -function svn_promote_rc_to_release { - local version="$1" - local rc_num="$2" - - local rc_tag="${TAG_PREFIX}${version}-rc${rc_num}" - local final_tag="${TAG_PREFIX}${version}" - local dev_url="${APACHE_DIST_URL}${APACHE_DIST_DEV_PATH}/${rc_tag}" - local release_url="${APACHE_DIST_URL}${APACHE_DIST_RELEASE_PATH}/${final_tag}" - - exec_process svn mv \ - --username "${SVN_USERNAME}" --password "${SVN_PASSWORD}" --non-interactive \ - "${dev_url}" "${release_url}" \ - -m "Release Apache Parquet ${version}" -} - # svn_remove_rc # Removes dist/dev/parquet// (used by cancel-rc.sh). function svn_remove_rc { @@ -134,16 +117,14 @@ function svn_remove_rc { # supported minor on dist.apache.org/release"; older minor branches are # left in place and must be retired manually. # +# The listing is an anonymous, read-only request, so it runs in dry-run +# mode too and needs no credentials. +# # Returns non-zero only on real svn-listing failure or invalid input. function svn_list_old_releases { local version_to_keep="$1" local release_base_url="${APACHE_DIST_URL}${APACHE_DIST_RELEASE_PATH}" - if [[ ${DRY_RUN:-1} -eq 1 ]]; then - print_command "Dry-run, WOULD list ${release_base_url}" >&2 - return 0 - fi - if [[ ! "${version_to_keep}" =~ ^${VERSION_REGEX}$ ]]; then print_error "svn_list_old_releases: invalid version '${version_to_keep}'" return 1 @@ -153,9 +134,7 @@ function svn_list_old_releases { local keep_patch="${BASH_REMATCH[3]}" local listing - if ! listing=$(svn list \ - --username "${SVN_USERNAME}" --password "${SVN_PASSWORD}" --non-interactive \ - "${release_base_url}" 2>&1); then + if ! listing=$(svn list --non-interactive "${release_base_url}" 2>&1); then print_error "Failed to list SVN releases at ${release_base_url}: ${listing}" return 1 fi @@ -173,16 +152,3 @@ function svn_list_old_releases { if (tail ~ /^[0-9]+$/ && (tail + 0) < (keep_patch + 0)) print $0 }' } - -# svn_remove_release -# svn rm a release directory under dist/release/parquet/. -function svn_remove_release { - local release_dir="$1" - local new_version="$2" - local release_base_url="${APACHE_DIST_URL}${APACHE_DIST_RELEASE_PATH}" - - exec_process svn rm \ - --username "${SVN_USERNAME}" --password "${SVN_PASSWORD}" --non-interactive \ - "${release_base_url}/${release_dir}" \ - -m "Remove old release ${release_dir} (superseded by ${new_version})" -} diff --git a/release/tests/svn.bats b/release/tests/svn.bats index 1647010a49..9970339975 100644 --- a/release/tests/svn.bats +++ b/release/tests/svn.bats @@ -54,28 +54,6 @@ setup() { [ ! -d "${BATS_TEST_TMPDIR}/tmp" ] } -# ---- svn_promote_rc_to_release ---- - -@test "svn_promote_rc_to_release: dry-run shows mv command" { - DRY_RUN=1 - run svn_promote_rc_to_release "1.18.0" "2" - [ "$status" -eq 0 ] - [[ "$output" == *"svn mv"* ]] - [[ "$output" == *"apache-parquet-1.18.0-rc2"* ]] - [[ "$output" == *"apache-parquet-1.18.0"* ]] - [[ "$output" == *"/dev/parquet"* ]] - [[ "$output" == *"/release/parquet"* ]] -} - -@test "svn_promote_rc_to_release: real mode invokes svn mv" { - DRY_RUN=0 - svn() { echo "SVN: $*"; return 0; } - export -f svn - run svn_promote_rc_to_release "1.18.0" "0" - [ "$status" -eq 0 ] - [[ "$output" == *"SVN: mv"* ]] -} - # ---- svn_remove_rc ---- @test "svn_remove_rc: dry-run shows rm command" { @@ -118,12 +96,22 @@ setup() { # touch other minors (1.8.x, 1.10.x), the kept version itself, or any # higher patch on the same minor. -@test "svn_list_old_releases: dry-run returns empty without calling svn" { +@test "svn_list_old_releases: lists anonymously, even in dry-run" { DRY_RUN=1 - run svn_list_old_releases "1.18.0" + svn() { + if [[ "$1" == "list" ]]; then + echo "ARGS: $*" >&2 + printf 'apache-parquet-1.18.0/\napache-parquet-1.18.1/\n' + return 0 + fi + return 99 + } + export -f svn + run svn_list_old_releases "1.18.1" [ "$status" -eq 0 ] - # No actual entries, just the dry-run banner on stderr - [ -z "$(echo "$output" | grep -v Dry-run | grep -v WOULD)" ] + [[ "$output" == *"apache-parquet-1.18.0"* ]] + [[ "$output" != *"--username"* ]] + [[ "$output" != *"--password"* ]] } @test "svn_list_old_releases: returns older patches on the same minor only" { @@ -267,25 +255,3 @@ setup() { [ "$status" -eq 1 ] [[ "$output" == *"Failed to list"* ]] } - -# ---- svn_remove_release ---- - -@test "svn_remove_release: dry-run shows rm command" { - DRY_RUN=1 - run svn_remove_release "apache-parquet-1.16.0" "1.18.0" - [ "$status" -eq 0 ] - [[ "$output" == *"svn rm"* ]] - [[ "$output" == *"apache-parquet-1.16.0"* ]] - [[ "$output" == *"superseded by 1.18.0"* ]] -} - -@test "svn_remove_release: real mode invokes svn rm with commit message" { - DRY_RUN=0 - svn() { echo "SVN: $*"; return 0; } - export -f svn - run svn_remove_release "apache-parquet-1.16.0" "1.18.0" - [ "$status" -eq 0 ] - [[ "$output" == *"SVN: rm"* ]] - [[ "$output" == *"apache-parquet-1.16.0"* ]] - [[ "$output" == *"superseded by 1.18.0"* ]] -}