Skip to content

Commit 0e94239

Browse files
committed
Simplify invocation
1 parent cda91e9 commit 0e94239

File tree

2 files changed

+43
-31
lines changed

2 files changed

+43
-31
lines changed

site/content/release-verify.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ Example (values taken from the 1.2.0-rc2 release)
9191
bash <(curl \
9292
-s https://raw.githubusercontent.com/apache/polaris/refs/heads/main/tools/verify-release/verify-release.sh) \
9393
--git-sha 354a5ef6b337bf690b7a12fefe2c984e2139b029 \
94-
--version 1.2.0 \
95-
--rc 2 \
94+
--version 1.3.0-incubating-rc0 \
9695
--maven-repo-id 1033
9796
```
9897

@@ -101,8 +100,7 @@ Same example, but using the short option names:
101100
bash <(curl \
102101
-s https://raw.githubusercontent.com/apache/polaris/refs/heads/main/tools/verify-release/verify-release.sh) \
103102
-s 354a5ef6b337bf690b7a12fefe2c984e2139b029 \
104-
-v 1.2.0 \
105-
-r 2 \
103+
-v 1.3.0-incubating-rc0 \
106104
-m 1033
107105
```
108106

@@ -123,12 +121,13 @@ After some startup checks, the tool emits some information about the release can
123121
Verifying staged release
124122
========================
125123
126-
Git tag: apache-polaris-1.2.0-incubating-rc2
124+
Git tag: apache-polaris-1.3.0-incubating-rc0
127125
Git sha: 354a5ef6b337bf690b7a12fefe2c984e2139b029
128-
Full version: 1.2.0-incubating
126+
Version: 1.3.0-incubating
127+
RC: 0
129128
Maven repo URL: https://repository.apache.org/content/repositories/orgapachepolaris-1033/
130-
Main dist URL: https://dist.apache.org/repos/dist/dev/incubator/polaris/1.2.0-incubating
131-
Helm chart URL: https://dist.apache.org/repos/dist/dev/incubator/polaris/helm-chart/1.2.0-incubating
129+
Main dist URL: https://dist.apache.org/repos/dist/dev/incubator/polaris/1.3.0-incubating
130+
Helm chart URL: https://dist.apache.org/repos/dist/dev/incubator/polaris/helm-chart/1.3.0-incubating
132131
Verify directory: /tmp/polaris-release-verify-2025-10-23-14-22-31-HPmmiybzk
133132
134133
A verbose log containing the identified issues will be available here:

tools/verify-release/verify-release.sh

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,24 @@ Usage: $0 [options]
3232
Mandatory options:
3333
-s | --git-sha | --sha <GIT_SHA> Git commit (full, not abbreviated)
3434
Example: b7188a07511935e7c9c64128dc047107c26f97f6
35-
-v | --version <version> Release version (without RC and 'incubating')
36-
Example: 1.2.0
37-
-r | --rc <rc-number> RC number (without a leading 'rc')
38-
Example: 1
35+
-v | --version <version> Release version, including '-incubating' and RC
36+
Example: 1.3.0-incubating-rc0
3937
-m | --maven-repo-id <staging-ID> Staging Maven repository staging ID
40-
Example: 1032
38+
Example: 1234
4139
This will be prefixed with ${maven_repo_url_prefix}
4240
4341
Optional arguments:
4442
-k | --keep-temp-dir Keep the temporary directory (default is to purge it once the script exits)
4543
-h | --help Show usage information (exits early)
4644
4745
48-
Full example for RC1 of 1.2.0, staging repo ID 1032.
49-
./verify-release.sh -s b7188a07511935e7c9c64128dc047107c26f97f6 -v 1.2.0 -r 1 -m 1032
46+
Full example for RC4 of version 9.8.0, staging repo ID 4568.
47+
./verify-release.sh -s b7188a07511935e7c9c64128dc047107c26f97f6 -v 9.8.0-incubating-rc4 -m 4568
5048
!
5149
}
5250

5351
git_sha=""
5452
version=""
55-
rc_num=""
5653
maven_repo_id=""
5754
keep_temp_dir=0
5855

@@ -67,10 +64,6 @@ while [[ $# -gt 0 ]]; do
6764
version="$2"
6865
shift
6966
;;
70-
-r | --rc)
71-
rc_num="$2"
72-
shift
73-
;;
7467
-m | --maven-repo-id)
7568
maven_repo_id="$2"
7669
shift
@@ -94,6 +87,23 @@ RED='\033[0;31m'
9487
ORANGE='\033[0;33m'
9588
RESET='\033[m'
9689

90+
# Allow leading characters, but only extract the version and rc.
91+
VERSION_RC_REGEX="^([a-z-]+)?([0-9]+\.[0-9]+\.[0-9]+(-incubating)?)-rc([0-9]+)$"
92+
if [[ ! ${version} =~ ${VERSION_RC_REGEX} ]]; then
93+
echo "Version '${version}' does not match the version pattern 0.0.0-incubating-rc0" > /dev/stderr
94+
exit 1
95+
fi
96+
version="${BASH_REMATCH[2]}"
97+
rc_num="${BASH_REMATCH[4]}"
98+
99+
# Allow leading characters for convenience, but extract the staging repo number.
100+
STAGING_REGEX="[a-z-]*([0-9]+)$"
101+
if [[ ! ${maven_repo_id} =~ ${STAGING_REGEX} ]]; then
102+
echo "Invalid Maven staging repo ID '${maven_repo_id}'" > /dev/stderr
103+
exit 1
104+
fi
105+
maven_repo_id="${BASH_REMATCH[1]}"
106+
97107
run_id="polaris-release-verify-$(date "+%Y-%m-%d-%k-%M-%S")"
98108
temp_dir="$(mktemp --tmpdir --directory "${run_id}-XXXXXXXXX")"
99109
function purge_temp_dir {
@@ -120,8 +130,7 @@ failures_file="$(pwd)/${run_id}.log"
120130
dist_url_prefix="https://dist.apache.org/repos/dist/dev/incubator/polaris/"
121131
keys_file_url="https://downloads.apache.org/incubator/polaris/KEYS"
122132

123-
version_full="${version}-incubating"
124-
git_tag_full="apache-polaris-${version_full}-rc${rc_num}"
133+
git_tag_full="apache-polaris-${version}-rc${rc_num}"
125134

126135
GITHUB=0
127136
[[ -n ${GITHUB_ENV} ]] && GITHUB=1
@@ -135,14 +144,14 @@ find_excludes=(
135144
'!' '-name' '*.sha256'
136145
'!' '-name' '*.sha512'
137146
# file with that name is created by wget when mirroring from 'dist'
138-
'!' '-name' "${version_full}"
147+
'!' '-name' "${version}"
139148
# ignore Maven repository metadata
140149
'!' '-name' 'maven-metadata*.xml'
141150
'!' '-name' 'archetype-catalog.xml'
142151
)
143152

144-
dist_url="${dist_url_prefix}${version_full}"
145-
helm_url="${dist_url_prefix}helm-chart/${version_full}"
153+
dist_url="${dist_url_prefix}${version}"
154+
helm_url="${dist_url_prefix}helm-chart/${version}"
146155
maven_repo_url="${maven_repo_url_prefix}${maven_repo_id}/"
147156

148157
function log_part_start {
@@ -223,6 +232,9 @@ function mirror {
223232
# Nuke the directory listings (index.html from server) and robots.txt...
224233
# (only wget2 downloads the robots.txt :( )
225234
find "${dir}" \( -name index.html -o -name robots.txt \) -exec rm {} +
235+
# The following is a hack for wget2, which behaves a bit different than wget.
236+
# If the server returns `Content-Type: application/x-gzip`, the file is stored gzipped,
237+
# although it's "plain text". Leaving it as gzip breaks signature + checksum tests.
226238
find "${dir}" -name "*.prov" | while read -r helmProv; do
227239
if gunzip -c "${helmProv}" > /dev/null 2>&1 ; then
228240
mv "${helmProv}" "${helmProv}.gz"
@@ -366,7 +378,8 @@ Verifying staged release
366378
367379
Git tag: ${git_tag_full}
368380
Git sha: ${git_sha}
369-
Full version: ${version_full}
381+
Version: ${version}
382+
RC: ${rc_num}
370383
Maven repo URL: ${maven_repo_url}
371384
Main dist URL: ${dist_url}
372385
Helm chart URL: ${helm_url}
@@ -404,7 +417,7 @@ log_part_start "Verify mandatory files in source tree"
404417
[[ -e "${worktree_dir}/DISCLAIMER" ]] || log_fatal "Mandatory DISCLAIMER file missing in source tree"
405418
[[ -e "${worktree_dir}/LICENSE" ]] || log_fatal "Mandatory LICENSE file missing in source tree"
406419
[[ -e "${worktree_dir}/NOTICE" ]] || log_fatal "Mandatory NOTICE file missing in source tree"
407-
[[ "$(cat "${worktree_dir}/version.txt")" == "${version_full}" ]] || log_fatal "version.txt in source tree does not contain expected version"
420+
[[ "$(cat "${worktree_dir}/version.txt")" == "${version}" ]] || log_fatal "version.txt in source tree does not contain expected version"
408421
log_part_end
409422

410423
# Mirror the helm chart content for the release, verify signatures and checksums
@@ -446,7 +459,7 @@ log_part_start "Comparing Maven repository artifacts, this will take a little wh
446459
while read -r fn ; do
447460
compare_binary_file "Maven repository artifact" "${fn}" "${maven_local_dir}" "${maven_repo_dir}"
448461
# verify that the "main" and sources jars contain LICENSE + NOTICE files
449-
[[ "${fn}" =~ .*-$version_full(-sources)?[.]jar ]] && (
462+
[[ "${fn}" =~ .*-$version(-sources)?[.]jar ]] && (
450463
if [[ $(zipinfo -1 "${maven_repo_dir}/${fn}" | grep --extended-regexp --count "^META-INF/(LICENSE|NOTICE)$") -ne 2 ]] ; then
451464
log_fatal "${fn}: Mandatory LICENSE/NOTICE files not in META-INF/"
452465
fi
@@ -455,8 +468,8 @@ done < "${temp_dir}/maven-local-files"
455468
log_part_end
456469

457470
log_part_start "Comparing main distribution artifacts"
458-
compare_binary_file "source tarball" "apache-polaris-${version_full}.tar.gz" "${worktree_dir}/build/distributions" "${dist_dir}"
459-
dist_file_prefix="polaris-bin-${version_full}"
471+
compare_binary_file "source tarball" "apache-polaris-${version}.tar.gz" "${worktree_dir}/build/distributions" "${dist_dir}"
472+
dist_file_prefix="polaris-bin-${version}"
460473
compare_binary_file "Polaris distribution tarball" "${dist_file_prefix}.tgz" "${worktree_dir}/runtime/distribution/build/distributions" "${dist_dir}"
461474
if [[ $(tar -tf "${dist_dir}/${dist_file_prefix}.tgz" | grep --extended-regexp --count "^${dist_file_prefix}/(DISCLAIMER|LICENSE|NOTICE)$") -ne 3 ]] ; then
462475
log_fatal "${dist_file_prefix}.tgz: Mandatory DISCLAIMER/LICENSE/NOTICE files not in ${dist_file_prefix}/"
@@ -473,7 +486,7 @@ mkdir -p "${helm_work_dir}/local" "${helm_work_dir}/staged"
473486
# Works with helm since version 4.0.0
474487
exec_process find "${worktree_dir}/helm/polaris" -exec touch -d "1980-01-01 00:00:00" {} +
475488
proc_exec "Helm packaging failed" helm package --destination "${helm_work_dir}" "${worktree_dir}/helm/polaris"
476-
helm_package_file="polaris-${version_full}.tgz"
489+
helm_package_file="polaris-${version}.tgz"
477490
tar --warning=no-timestamp -xf "${helm_dir}/${helm_package_file}" --directory "${helm_work_dir}/staged" || true
478491
tar --warning=no-timestamp -xf "${helm_work_dir}/${helm_package_file}" --directory "${helm_work_dir}/local" || true
479492
proc_exec "Helm package ${helm_package_file} contents" diff -r "${helm_work_dir}/local" "${helm_work_dir}/staged"

0 commit comments

Comments
 (0)