Bug 1247168 - Install Mercurial 3.8.4 in lint image; r?dustin
Like we do for the decision image, we install Mercurial 3.8.4 from deb
files hosted on tooltool. This provides more control and determinism
than installing via apt.
As part of this change, Mercurial is upgraded from whatever was hosted
in apt to 3.8.4.
Since the deb packages don't provide a global hgrc, we create one
ourselves. This is effectively copied from the decision image.
Most of the work is being done in a new, standalone
install-mercurial.sh script. This script is part of the
newly-established testing/docker/recipes directory. The intent of this
directory is to hold common files referenced by multiple images. Our
custom Dockerfile syntax to include files from outside the directory
with the Dockerfile is used to add these files to the build context.
MozReview-Commit-ID: K7gVm2Geihj
--- a/testing/docker/lint/Dockerfile
+++ b/testing/docker/lint/Dockerfile
@@ -3,19 +3,20 @@ MAINTAINER Andrew Halberstadt <ahalbe
RUN useradd -d /home/worker -s /bin/bash -m worker
WORKDIR /home/worker
RUN mkdir /build
# %include testing/docker/decision/tooltool.py
ADD topsrcdir/testing/docker/decision/tooltool.py /build/tooltool.py
-# Install lint packages
-ADD system-setup.sh /tmp/system-setup.sh
-RUN bash /tmp/system-setup.sh
+# %include testing/docker/recipes/install-mercurial.sh
+ADD topsrcdir/testing/docker/recipes/install-mercurial.sh /build/install-mercurial.sh
+ADD system-setup.sh /tmp/system-setup.sh
+RUN bash /tmp/system-setup.sh
# Set variable normally configured at login, by the shells parent process, these
# are taken from GNU su manual
ENV HOME /home/worker
ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME worker
ENV HOSTNAME taskcluster-worker
--- a/testing/docker/lint/system-setup.sh
+++ b/testing/docker/lint/system-setup.sh
@@ -6,17 +6,16 @@ set -ve
test `whoami` == 'root'
mkdir -p /setup
cd /setup
apt_packages=()
apt_packages+=('curl')
-apt_packages+=('mercurial')
apt_packages+=('python')
apt_packages+=('python-pip')
apt_packages+=('sudo')
apt_packages+=('xz-utils')
apt-get update
apt-get install -y ${apt_packages[@]}
@@ -26,16 +25,18 @@ locale-gen en_US.UTF-8
dpkg-reconfigure locales
tooltool_fetch() {
cat >manifest.tt
/build/tooltool.py fetch
rm manifest.tt
}
+cd /build
+. install-mercurial.sh
###
# ESLint Setup
###
# install node
# For future reference things like this don't need to be uploaded to tooltool, as long
new file mode 100644
--- /dev/null
+++ b/testing/docker/recipes/install-mercurial.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This script installs and configures Mercurial.
+
+set -e
+
+# ASSERTION: We are running Ubuntu 16.04.
+tooltool_fetch <<EOF
+[
+{
+ "size": 44878,
+ "digest": "7b1fc1217e0dcaeea852b0af2dc559b1aafb704fbee7e29cbec75af57bacb84910a7ec92b5c33f04ee98f23b3a57f1fa451173fe7c8a96f58faefe319dc7dde1",
+ "algorithm": "sha512",
+ "filename": "mercurial_3.8.4_amd64.deb"
+},
+{
+ "size": 1818422,
+ "digest": "b476e2612e7495a1c7c5adfd84511aa7479e26cc9070289513ec705fbfc4c61806ce2dbcceca0e63f2e80669be416f3467a3cebb522dcb8a6aeb62cdd3df82f2",
+ "algorithm": "sha512",
+ "filename": "mercurial-common_3.8.4_all.deb"
+}
+]
+EOF
+
+dpkg -i mercurial-common_3.8.4_all.deb mercurial_3.8.4_amd64.deb
+
+mkdir -p /etc/mercurial
+cat >/etc/mercurial/hgrc <<EOF
+# By default the progress bar starts after 3s and updates every 0.1s. We
+# change this so it shows and updates every 1.0s.
+[progress]
+delay = 1.0
+refresh = 1.0
+
+[web]
+cacerts = /etc/ssl/certs/ca-certificates.crt
+EOF
+
+chmod 644 /etc/mercurial/hgrc