Bug 1448438 - Install Mercurial via install-mercurial.sh; r?Callek
All in-tree Docker images should be installing Mercurial via
install-mercurial.sh so that the Mercurial install is consistent
across all Docker images.
I noticed this image wasn't using install-mercurial.sh because
attempting to rebuild the image currently fails due to
mercurial-4.3.1-2 not being available in the upstream package repo.
install-mercurial.sh has been taught to handle Ubuntu 18.04 and the
Docker image building process has been taught to use
install-mercurial.sh. install-mercurial.sh uses tooltool and behavior
should work and be deterministic over all of time.
As part of this, we had to establish a standalone shell script for
building the image. That's because install-mercurial.sh requires a
"tooltool_fetch" alias. Meaningful image building code has been
moved into the new setup.sh. This also means things run as a single
RUN statement. So we don't need to hack around minimizing RUN
invocations.
I also discovered that the pinned curl version is no longer available.
So I removed the version pinning. FWIW we can't rely on version
pinning unless the Apt repository is snapshotted. Packages do get
yanked from time to time. Unless we absolutely require a specific
version of a specific package, we can probably get away without pinning
- at least for this Docker image. But that can be a follow-up.
MozReview-Commit-ID: As7Hq470QcK
--- a/taskcluster/docker/periodic-updates/Dockerfile
+++ b/taskcluster/docker/periodic-updates/Dockerfile
@@ -1,36 +1,29 @@
FROM ubuntu:bionic
MAINTAINER Simon Fraser <sfraser@mozilla.com>
# Required software
ENV DEBIAN_FRONTEND noninteractive
-# Chain apt-get commands with apt-get clean in a single docker RUN
-# to make sure that files are removed within a single docker layer
+# %include python/mozbuild/mozbuild/action/tooltool.py
+ADD topsrcdir/python/mozbuild/mozbuild/action/tooltool.py /setup/tooltool.py
+
+# %include testing/mozharness/external_tools/robustcheckout.py
+ADD topsrcdir/testing/mozharness/external_tools/robustcheckout.py /usr/local/mercurial/robustcheckout.py
-RUN apt-get update -q && \
- apt-get install -y --no-install-recommends \
- arcanist=0~git20170812-1 \
- bzip2=1.0.6-8.1 \
- ca-certificates=20170717 \
- curl=7.58.0-2ubuntu2 \
- jq=1.5+dfsg-2 \
- libdbus-glib-1-2=0.110-2 \
- libgtk-3-0=3.22.28-1ubuntu3 \
- libxml2-utils=2.9.4+dfsg1-6.1ubuntu1 \
- libxt6=1:1.1.5-1 \
- mercurial=4.3.1-2 \
- python3=3.6.4-1 \
- shellcheck=0.4.6-1 \
- unzip=6.0-21ubuntu1 \
- wget=1.19.4-1ubuntu2 \
- && apt-get clean
+# %include taskcluster/docker/recipes/hgrc
+COPY topsrcdir/taskcluster/docker/recipes/hgrc /etc/mercurial/hgrc.d/mozilla.rc
-RUN useradd -d /home/worker -s /bin/bash -m worker
+# %include taskcluster/docker/recipes/install-mercurial.sh
+ADD topsrcdir/taskcluster/docker/recipes/install-mercurial.sh /setup/install-mercurial.sh
+
+ADD setup.sh /setup/setup.sh
+
+RUN cd /setup && ./setup.sh
COPY runme.sh /
COPY scripts/* /home/worker/scripts/
ENV HOME /home/worker
ENV SHELL /bin/bash
ENV USER worker
ENV LOGNAME worker
new file mode 100755
--- /dev/null
+++ b/taskcluster/docker/periodic-updates/setup.sh
@@ -0,0 +1,37 @@
+#!/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/.
+
+set -ve
+
+tooltool_fetch() {
+ cat >manifest.tt
+ python2.7 /setup/tooltool.py fetch
+ rm manifest.tt
+}
+
+useradd -d /home/worker -s /bin/bash -m worker
+
+apt-get update -q
+apt-get install -y --no-install-recommends \
+ arcanist=0~git20170812-1 \
+ bzip2=1.0.6-8.1 \
+ ca-certificates \
+ curl \
+ jq=1.5+dfsg-2 \
+ libdbus-glib-1-2=0.110-2 \
+ libgtk-3-0=3.22.28-1ubuntu3 \
+ libxml2-utils=2.9.4+dfsg1-6.1ubuntu1 \
+ libxt6=1:1.1.5-1 \
+ python \
+ python3=3.6.4-1 \
+ shellcheck=0.4.6-1 \
+ unzip=6.0-21ubuntu1 \
+ wget=1.19.4-1ubuntu2 \
+
+apt-get clean
+
+. install-mercurial.sh
+
+rm -rf /setup
--- a/taskcluster/docker/recipes/install-mercurial.sh
+++ b/taskcluster/docker/recipes/install-mercurial.sh
@@ -8,17 +8,17 @@
set -e
# Detect OS.
if [ -f /etc/lsb-release ]; then
# Disabled so linting works on Mac
# shellcheck disable=SC1091
. /etc/lsb-release
- if [ "${DISTRIB_ID}" = "Ubuntu" ] && [[ "${DISTRIB_RELEASE}" = "16.04" || "${DISTRIB_RELEASE}" = "17.10" ]]
+ if [ "${DISTRIB_ID}" = "Ubuntu" ] && [[ "${DISTRIB_RELEASE}" = "16.04" || "${DISTRIB_RELEASE}" = "17.10" || "${DISTRIB_RELEASE}" = "18.04" ]]
then
HG_DEB=1
HG_DIGEST=458746bd82b4732c72c611f1041f77a47a683bc75ff3f6ab7ed86ea394f48d94cd7e2d3d1d5b020906318a9a24bea27401a3a63d7e645514dbc2cb581621977f
HG_SIZE=193710
HG_FILENAME=mercurial_4.4.2_amd64.deb
HG_COMMON_DIGEST=8074efbfff974f0bbdd0c3be3d272cc7a634456921e04db31369fbec1c9256ddaf44bdbe120f6f33113d2be9324a1537048028ebaaf205c6659e476a757358fd
HG_COMMON_SIZE=2097892