Commit 568cf453 authored by intrigeri's avatar intrigeri
Browse files

Add a build option to apply a date offset, for reproducibility testing (refs: #12339).

parent df7df11d
......@@ -31,7 +31,7 @@ VAGRANT_PATH = File.expand_path('../vagrant', __FILE__)
STABLE_BRANCH_NAMES = ['stable', 'testing']
# Environment variables that will be exported to the build script
EXPORTED_VARIABLES = ['http_proxy', 'MKSQUASHFS_OPTIONS', 'TAILS_RAM_BUILD', 'TAILS_CLEAN_BUILD', 'TAILS_OFFLINE_MODE']
EXPORTED_VARIABLES = ['http_proxy', 'MKSQUASHFS_OPTIONS', 'TAILS_RAM_BUILD', 'TAILS_CLEAN_BUILD', 'TAILS_OFFLINE_MODE', 'TAILS_DATE_OFFSET']
# Let's save the http_proxy set before playing with it
EXTERNAL_HTTP_PROXY = ENV['http_proxy']
......@@ -191,6 +191,8 @@ task :parse_build_options do
# Git settings
when 'ignorechanges'
ENV['TAILS_BUILD_IGNORE_CHANGES'] = '1'
when /dateoffset=([-+]\d+)/
ENV['TAILS_DATE_OFFSET'] = $1
when 'noprovision'
ENV['TAILS_NO_AUTO_PROVISION'] = '1'
else
......
......@@ -45,6 +45,10 @@ old_build_dirs() {
perl -ni -E 'say $mountpoint if (($mountpoint) = ($_ =~ m{^(?:aufs|tmpfs|devpts-live|proc-live|sysfs-live) on (/tmp/tails-build(?:-tmpfs)?\.[/[:alnum:]]+)}))'
}
ntp_synchronized() {
timedatectl status | grep -qs -E '^\s*NTP\s+synchronized:\s+yes$'
}
trap cleanup EXIT
if [ -n "$JENKINS_URL" ]; then
......@@ -108,6 +112,19 @@ fi
install -m 0755 -d "$ARTIFACTS_DIR"
as_root_do timedatectl set-ntp true
echo -n "Waiting for the time to be synchronized..."
while ! ntp_synchronized; do
sleep 1
echo -n "."
done
echo " done."
if [ -n "$TAILS_DATE_OFFSET" ]; then
as_root_do timedatectl set-ntp false
DESIRED_DATE=$(date --utc --date="${TAILS_DATE_OFFSET} days" '+%F %T')
as_root_do timedatectl set-time "$DESIRED_DATE"
fi
if [ -z "$JENKINS_URL" ]; then
./build-website
fi
......
......@@ -109,6 +109,9 @@ apt-get -y --no-install-recommends install \
perlmagick \
wdg-html-validator
# Ensure we can use timedatectl
apt-get -y install dbus
# Add build script
install -o root -g root -m 755 /vagrant/provision/assets/build-tails /usr/local/bin
......
......@@ -251,6 +251,14 @@ uncommitted changes. This behaviour can be controlled by:
* **ignorechanges**: allow to make a build that will ignore changes in the Git
repository.
### Other variations useful for testing build reproducibility
An offset can be applied to the current date in the virtual machine
through:
* **dateoffset=_+n_**, **dateoffset=_-n_**: change the virtual
machine system time by _+n_ or _-n_ days.
### Example
The fastest build you could pretend to get can be done by setting:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment