@@ -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
5351git_sha=" "
5452version=" "
55- rc_num=" "
5653maven_repo_id=" "
5754keep_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'
9487ORANGE=' \033[0;33m'
9588RESET=' \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+
97107run_id=" polaris-release-verify-$( date " +%Y-%m-%d-%k-%M-%S" ) "
98108temp_dir=" $( mktemp --tmpdir --directory " ${run_id} -XXXXXXXXX" ) "
99109function purge_temp_dir {
@@ -120,8 +130,7 @@ failures_file="$(pwd)/${run_id}.log"
120130dist_url_prefix=" https://dist.apache.org/repos/dist/dev/incubator/polaris/"
121131keys_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
126135GITHUB=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 } "
146155maven_repo_url=" ${maven_repo_url_prefix}${maven_repo_id} /"
147156
148157function 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
367379Git tag: ${git_tag_full}
368380Git sha: ${git_sha}
369- Full version: ${version_full}
381+ Version: ${version}
382+ RC: ${rc_num}
370383Maven repo URL: ${maven_repo_url}
371384Main dist URL: ${dist_url}
372385Helm 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"
408421log_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
446459while 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"
455468log_part_end
456469
457470log_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 } "
460473compare_binary_file " Polaris distribution tarball" " ${dist_file_prefix} .tgz" " ${worktree_dir} /runtime/distribution/build/distributions" " ${dist_dir} "
461474if [[ $( 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
474487exec_process find " ${worktree_dir} /helm/polaris" -exec touch -d " 1980-01-01 00:00:00" {} +
475488proc_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"
477490tar --warning=no-timestamp -xf " ${helm_dir} /${helm_package_file} " --directory " ${helm_work_dir} /staged" || true
478491tar --warning=no-timestamp -xf " ${helm_work_dir} /${helm_package_file} " --directory " ${helm_work_dir} /local" || true
479492proc_exec " Helm package ${helm_package_file} contents" diff -r " ${helm_work_dir} /local" " ${helm_work_dir} /staged"
0 commit comments