Skip to content

Commit 3575360

Browse files
authored
GH-47081: [Release] Verify reproducible source build explicitly (#47082)
### Rationale for this change There are 2 problems on verification of reproducible source archive: 1. CI on macOS isn't prepared correctly 2. Some verification environments may not have required tools FYI: We need the following to check reproducible build on macOS: * Ensure using apache/arrow for `GITHUB_REPOSITORY` * `GITHUB_REPOSITORY` is defined automatically on GitHub Actions. Our Crossbow based verification job has `GITHUB_REPOSITORY=ursacomputing/crossbow` by default. * GNU tar * GNU gzip ### What changes are included in this PR? For the problem1: * Set `GITHUB_REPOSITORY` explicitly * Install GNU gzip (GNU tar is already installed) For the problem2: * Add `TEST_SOURCE_REPRODUCIBLE` that is `0` by default * Set `TEST_SOURCE_REPRODUCIBLE=1` on CI * At least one PMC member must set `TEST_SOURCE_REPRODUCIBLE=1` on release verification ### Are these changes tested? Yes. ### Are there any user-facing changes? No. * GitHub Issue: #47081 Authored-by: Sutou Kouhei <kou@clear-code.com> Signed-off-by: Sutou Kouhei <kou@clear-code.com>
1 parent f52d81b commit 3575360

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

dev/release/verify-release-candidate.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -789,14 +789,6 @@ ensure_source_directory() {
789789
if [ ! -d "${ARROW_SOURCE_DIR}" ]; then
790790
pushd $ARROW_TMPDIR
791791
fetch_archive ${dist_name}
792-
git clone https://github.com/${GITHUB_REPOSITORY}.git arrow
793-
pushd arrow
794-
dev/release/utils-create-release-tarball.sh ${VERSION} ${RC_NUMBER}
795-
if ! cmp ${dist_name}.tar.gz ../${dist_name}.tar.gz; then
796-
echo "Source archive isn't reproducible"
797-
return 1
798-
fi
799-
popd
800792
tar xf ${dist_name}.tar.gz
801793
popd
802794
fi
@@ -845,6 +837,27 @@ test_source_distribution() {
845837

846838
pushd $ARROW_SOURCE_DIR
847839

840+
if [ "${SOURCE_KIND}" = "tarball" ] && [ "${TEST_SOURCE_REPRODUCIBLE}" -gt 0 ]; then
841+
pushd ..
842+
git clone "https://github.com/${GITHUB_REPOSITORY}.git" arrow
843+
pushd arrow
844+
dev/release/utils-create-release-tarball.sh "${VERSION}" "${RC_NUMBER}"
845+
tarball="apache-arrow-${VERSION}.tar.gz"
846+
if ! cmp "${tarball}" "../${tarball}"; then
847+
echo "Source archive isn't reproducible"
848+
if ! tar --version | grep --quiet --fixed GNU && \
849+
! gtar --version | grep --quiet --fixed GNU; then
850+
echo "We need GNU tar to verify reproducible build"
851+
fi
852+
if ! gzip --version | grep --quiet --fixed GNU; then
853+
echo "We need GNU gzip to verify reproducible build"
854+
fi
855+
return 1
856+
fi
857+
popd
858+
popd
859+
fi
860+
848861
if [ ${TEST_CSHARP} -gt 0 ]; then
849862
test_csharp
850863
fi
@@ -1033,6 +1046,7 @@ test_wheels() {
10331046
: ${TEST_YUM:=${TEST_BINARIES}}
10341047

10351048
# Source verification tasks
1049+
: ${TEST_SOURCE_REPRODUCIBLE:=0}
10361050
: ${TEST_CPP:=${TEST_SOURCE}}
10371051
: ${TEST_CSHARP:=${TEST_SOURCE}}
10381052
: ${TEST_GLIB:=${TEST_SOURCE}}

dev/tasks/verify-rc/github.linux.amd64.docker.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ jobs:
5252
{% endif %}
5353
-e VERIFY_RC="{{ rc|default("") }}" \
5454
-e TEST_DEFAULT=0 \
55+
{% if target == "cpp" %}
56+
-e TEST_SOURCE_REPRODUCIBLE=1 \
57+
{% endif %}
5558
-e TEST_{{ target|upper }}=1 \
5659
{{ distro }}-verify-rc
5760

dev/tasks/verify-rc/github.macos.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959
if [ -x "${pkgconf}" ]; then
6060
echo "PKG_CONFIG=${pkgconf}" >> $GITHUB_ENV
6161
fi
62+
63+
# For reproducible source archive verification
64+
brew install gzip
6265
{% endif %}
6366

6467
- uses: actions/setup-java@v2
@@ -91,6 +94,18 @@ jobs:
9194
USE_CONDA: 1
9295
{% else %}
9396
GTest_SOURCE: SYSTEM
97+
{% if target == "cpp" %}
98+
TEST_SOURCE_REPRODUCIBLE: 1
99+
{% endif %}
94100
{% endif %}
95101
run: |
96-
arrow/dev/release/verify-release-candidate.sh {{ release|default("") }} {{ rc|default("") }}
102+
version={{ release|default("") }}
103+
rc={{ rc|default("") }}
104+
if [ -n "${version}" ] && [ -n "${rc}" ]; then
105+
args=("${version}" "${rc}")
106+
GITHUB_REPOSITORY=apache/arrow
107+
else
108+
args=()
109+
GITHUB_REPOSITORY={{ arrow.github_repo }}
110+
fi
111+
arrow/dev/release/verify-release-candidate.sh "${args[@]}"

0 commit comments

Comments
 (0)