[
https://issues.apache.org/jira/browse/HADOOP-19976?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18147880#comment-18147880
]
ASF GitHub Bot commented on HADOOP-19976:
-----------------------------------------
charlesconnell commented on code in PR #8811:
URL: https://github.com/apache/hadoop/pull/8811#discussion_r4635921450
##########
dev-support/bin/create-release:
##########
@@ -524,6 +579,8 @@ function dockermode
printf "\n\n"
) | docker build -t "${imgname}" -f - "${BASEDIR}"/dev-support/docker/
Review Comment:
You should ensure docker image build was successful, so that the `docker
run` isn't using an older build of the image.
##########
hadoop-common-project/hadoop-auth-examples/pom.xml:
##########
@@ -85,7 +85,7 @@
<configuration>
<mainClass>org.apache.hadoop.security.authentication.examples.WhoClient</mainClass>
<arguments>
- <argument>${url}</argument>
+ <argument>${project.url}</argument>
Review Comment:
This change needs a counterpart change on line 100 of Examples.md
##########
dev-support/bin/hadoop-maketar:
##########
@@ -0,0 +1,62 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Create a gzipped tar, optionally with every entry normalised so that the
+# same input tree always produces the same bytes.
+#
+# hadoop-maketar <timestamp> <output.tar.gz> <path> [<path>...]
+#
+# <timestamp> is project.build.outputTimestamp: an ISO-8601 instant, seconds
+# since the epoch, or a value of one character or less meaning "not set", in
+# which case the archive is built exactly as it always was. Paths are relative
+# to the working directory. Symlinks are preserved.
+
+set -o pipefail
+
+if [[ $# -lt 3 ]]; then
+ echo "usage: $(basename "$0") <timestamp> <output.tar.gz> <path>..." >&2
+ exit 1
+fi
+
+timestamp=$1
+output=$2
+shift 2
+
+tarflags=()
+gzipflags=()
+
+if [[ ${#timestamp} -gt 1 ]]; then
+ if tar --version 2>/dev/null | head -1 | grep -q 'GNU tar'; then
+ # All digits means epoch seconds, which GNU tar wants prefixed with '@'.
+ if [[ ${timestamp} =~ ^[0-9]+$ ]]; then
+ mtime="@${timestamp}"
+ else
+ mtime=${timestamp}
+ fi
+ # --format=gnu because the pax default writes atime and ctime headers.
+ # --mode drops the group and other write bits, so the result does not
+ # depend on the umask the tree was built under.
+ tarflags=(--sort=name "--mtime=${mtime}"
+ --owner=0 --group=0 --numeric-owner
+ --format=gnu --mode=go-w)
Review Comment:
This use of `--mode` does not fully specify the desired file mode, so this
script won't necessarily always produce a tarball with identical mode.
##########
dev-support/bin/create-release:
##########
@@ -192,6 +194,15 @@ function set_defaults
ARTIFACTS_DIR="${BASEDIR}/target/artifacts"
+ # project.build.outputTimestamp to stamp into the tarballs on repeatable
builds only.
+ # values
+ # fixed: use the repeatable timestamp
+ # git: use git commit
+ # iso/epoch number: use that date
+ # empty or string length = 1: unset. Use the current time (default)
+ BUILD_TIMESTAMP="-"
+ REPEATABLE=false
Review Comment:
Permitting a build to be nominally repeatable, while also allowing it to use
the current time as the build timestamp, seems like a contradiction. I think
that the option to use the current time should be disallowed.
##########
BUILDING.txt:
##########
@@ -391,6 +392,83 @@ Create a local staging version of the website (in
/tmp/hadoop-site)
Note that the site needs to be built in a second pass after other artifacts.
+----------------------------------------------------------------------------------
+Repeatable builds:
+
+By default a Hadoop build records the machine it was built on: the username,
the
+wall-clock time, the git remote/branch/commit and the OS classifier all end up
+inside the published JARs. Two builds of the same source therefore produce
+different bytes, and there is no way to confirm that a JAR in a repository was
+built from the release tag.
+
+The 'repeatable' profile replaces every one of those values with a fixed one:
+
+ $ mvn package -Prepeatable -Pdist,src -DskipTests -Dtar
+
+Given the same source, the same JDK and the same declared timestamp, this
+produces byte-identical .jar, -sources.jar, -javadoc.jar, .pom and the source
+tarball whoever runs the build and wherever they run it. It works from a git
+checkout and from the unpacked hadoop-X.Y.Z-src.tar.gz alike.
+
+What the profile fixes:
+
+ * project.build.outputTimestamp, which fixes the entry timestamps in every
+ archive written by Maven, and drops the generation timestamp from the
+ CycloneDX BOMs.
+ * The build time, git URI, branch and commit recorded in the version-info
+ resources: git is not invoked at all.
+ * The build username, reported as 'hadoop', and the compile platform,
+ reported as 'Unknown'.
+ * Javadoc, generated with -notimestamp.
+
+So 'hadoop version' reports fixed values under this profile. That is the trade:
+the version resources describe the source, not the build host. The source
+checksum, which is what actually ties a jar back to its inputs, is unaffected.
+
+The instant recorded is the hadoop.build.timestamp property in the top-level
+pom.xml. It is a committed constant so that it travels inside the source
+tarball; the release manager bumps it when cutting a release branch. Override
it
+for a one-off with -Dhadoop.build.timestamp=<ISO-8601 instant or epoch
seconds>.
+
+Preconditions for reproducing someone else's build:
+
+ * The same JDK major version and vendor. The compiler output, the javadoc
HTML
+ and the Build-Jdk-Spec manifest entries are all JDK-specific. This is
normal
+ for Maven reproducible builds.
+ * umask 022, for the jars. The archiver copies each file's on-disk
+ permissions into the ZIP entry metadata.
+ The tarballs are not affected, being written with fixed permissions and
ownership.
+ Source JARs carry the permissions of the source directories themselves,
+ so unpack the source release under the same umask as well as building
under it.
+ * The same architecture, for the binary distribution rather than for the
+ JARs. The hadoop JARS do not depend on the architecture.
+ What does differ is the distribution layout, because the root aarch64
+ profile substitutes a different leveldbjni artifact into
+ share/hadoop/*/lib, and native code is platform-specific.
+
+ASF releases are built in docker images set up under dev-support/docker/; these
+recreate the build environment as much as possible.
+
+Not yet reproducible, and out of scope of the profile:
+
+ * The generated site, which stamps a publication date into each page.
+ * Native code, which embeds absolute build paths
+ * The YARN UI, which downloads its javascript toolchain at build time.
+ * The binary .tar.gz distribution.
+ This contains the YARN UI and, where built, the native libraries.
+
+Never reproducible
+
+ * GPG signatures. These are unique, even if signed by the same principal, as
they
+ include a signing timestamp.
+
+To check a build, run it twice into two different directories, varying anything
+you believe does not matter - TZ, LC_ALL, the absolute path, the OS user - and
+compare:
+
+ $ find . -path '*/target/*.jar' -not -path '*/target/*/*' -exec sha512sum {}
+ \
+ | sed 's#.*/##' | sort > /tmp/build1.txt
Review Comment:
Your `sed` usage is dropping the checksums, so this effectively only
compares filenames, which I assume was not your intention.
> Support reproducible builds
> ---------------------------
>
> Key: HADOOP-19976
> URL: https://issues.apache.org/jira/browse/HADOOP-19976
> Project: Hadoop Common
> Issue Type: Improvement
> Components: build
> Affects Versions: 3.5.1, 3.6.0
> Reporter: Steve Loughran
> Assignee: Steve Loughran
> Priority: Major
> Labels: pull-request-available
>
> Add a profile to make Hadoop builds reproducible; enable in asf release
> builds so that these are repeatable, after which Apache Trusted Releases can
> be used to automate releasing
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]