|
| 1 | +#!/usr/bin/env bash |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | +# |
| 20 | +# Verifies a PyIceberg release candidate, following the steps in |
| 21 | +# mkdocs/docs/verify-release.md: signatures, checksums, license |
| 22 | +# documentation (RAT), and the test suite of the source distribution. |
| 23 | + |
| 24 | +set -euo pipefail |
| 25 | + |
| 26 | +if [ "$#" -ne 1 ]; then |
| 27 | + echo "Usage: $0 <version>" |
| 28 | + echo " e.g.: $0 0.6.1rc3" |
| 29 | + exit 1 |
| 30 | +fi |
| 31 | + |
| 32 | +PYICEBERG_VERSION="$1" |
| 33 | +# remove the rcX qualifier, the artifacts inside the RC are named after the release |
| 34 | +PYICEBERG_RELEASE_VERSION="${PYICEBERG_VERSION%rc*}" |
| 35 | +PYICEBERG_VERIFICATION_DIR="${PYICEBERG_VERIFICATION_DIR:-/tmp/pyiceberg/${PYICEBERG_VERSION}}" |
| 36 | + |
| 37 | +# Set to 0 to skip a step, e.g. VERIFY_TEST=0 ./dev/release/verify_rc.sh 0.6.1rc3 |
| 38 | +: "${VERIFY_SIGN:=1}" |
| 39 | +: "${VERIFY_CHECKSUM:=1}" |
| 40 | +: "${VERIFY_LICENSE:=1}" |
| 41 | +: "${VERIFY_TEST:=1}" |
| 42 | + |
| 43 | +if type shasum >/dev/null 2>&1; then |
| 44 | + sha512_verify="shasum -a 512 --check" |
| 45 | +else |
| 46 | + sha512_verify="sha512sum --check" |
| 47 | +fi |
| 48 | + |
| 49 | +import_gpg_keys() { |
| 50 | + echo "--- Importing KEYS" |
| 51 | + curl --fail --location --show-error --silent https://downloads.apache.org/iceberg/KEYS | gpg --import |
| 52 | +} |
| 53 | + |
| 54 | +download_rc() { |
| 55 | + echo "--- Downloading pyiceberg-${PYICEBERG_VERSION}" |
| 56 | + svn checkout "https://dist.apache.org/repos/dist/dev/iceberg/pyiceberg-${PYICEBERG_VERSION}/" "${PYICEBERG_VERIFICATION_DIR}" |
| 57 | +} |
| 58 | + |
| 59 | +verify_signatures() { |
| 60 | + echo "--- Verifying signatures" |
| 61 | + for name in pyiceberg-*.whl pyiceberg-*.tar.gz; do |
| 62 | + gpg --verify "${name}.asc" "${name}" |
| 63 | + done |
| 64 | +} |
| 65 | + |
| 66 | +verify_checksums() { |
| 67 | + echo "--- Verifying checksums" |
| 68 | + for name in pyiceberg-*.whl.sha512 pyiceberg-*.tar.gz.sha512; do |
| 69 | + ${sha512_verify} "${name}" |
| 70 | + done |
| 71 | +} |
| 72 | + |
| 73 | +extract_source_distribution() { |
| 74 | + echo "--- Extracting pyiceberg-${PYICEBERG_RELEASE_VERSION}.tar.gz" |
| 75 | + tar xzf "pyiceberg-${PYICEBERG_RELEASE_VERSION}.tar.gz" |
| 76 | +} |
| 77 | + |
| 78 | +verify_license_documentation() { |
| 79 | + echo "--- Running RAT checks" |
| 80 | + ./dev/check-license |
| 81 | +} |
| 82 | + |
| 83 | +test_source_distribution() { |
| 84 | + echo "--- Installing and running the tests, this spins up Docker containers" |
| 85 | + make install |
| 86 | + make test-coverage |
| 87 | +} |
| 88 | + |
| 89 | +echo "Verifying pyiceberg-${PYICEBERG_VERSION} in ${PYICEBERG_VERIFICATION_DIR}" |
| 90 | + |
| 91 | +if [ "${VERIFY_SIGN}" -gt 0 ]; then |
| 92 | + import_gpg_keys |
| 93 | +fi |
| 94 | + |
| 95 | +download_rc |
| 96 | +cd "${PYICEBERG_VERIFICATION_DIR}" |
| 97 | + |
| 98 | +if [ "${VERIFY_SIGN}" -gt 0 ]; then |
| 99 | + verify_signatures |
| 100 | +fi |
| 101 | + |
| 102 | +if [ "${VERIFY_CHECKSUM}" -gt 0 ]; then |
| 103 | + verify_checksums |
| 104 | +fi |
| 105 | + |
| 106 | +extract_source_distribution |
| 107 | +cd "pyiceberg-${PYICEBERG_RELEASE_VERSION}" |
| 108 | + |
| 109 | +if [ "${VERIFY_LICENSE}" -gt 0 ]; then |
| 110 | + verify_license_documentation |
| 111 | +fi |
| 112 | + |
| 113 | +if [ "${VERIFY_TEST}" -gt 0 ]; then |
| 114 | + test_source_distribution |
| 115 | +fi |
| 116 | + |
| 117 | +echo "RC looks good! Cast your vote on the dev mailing list." |
0 commit comments