Read about our upcoming Code of Conduct on this issue

Commit d70c2771 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Adding builds for Mercurial default and stable

The `--cleanup` flag is crucial here: because the kaniko builds
happen sequentially, without the flag, the last one (fixed,
released hg version) would have the Mercurial install shadowed
by previous builds, resulting in a missing Mercurial.

We've considered several options there, ideally we
could have built directly from the Octobus ci-py3 image, but we
lack a clear binary distribution format (there's `setup.py bdist`
that produces a tarball rooted at /usr/local, but then we'd have
to painfully extract and be 100% sure there's nothing to be cleaned up).

Another option would have been simply

   pip install -r https://www.mercurial-scm.org/repo/hg/archive/default.tar.bz2

But even at a daily build rate, it's not really nice to the upstream server,
and we could need punctiallly to produce several images in a row,
as I am actually doing while preparing this.

On the other hand, the Octobus ci-py3 image has clones attached to
mirror.octobus.net, so that's the compromise we chose.

In the future, we can also perhaps trigger from a periodic pull in
https://foss.heptapod.net/octobus/mercurial-devel or in the pull from
mercurial-mirror, building only for non trivial changes.
parent c050d19dae60
......@@ -23,7 +23,19 @@ fi
set -u
set -x
# TODO add separate loop for hg-default and hg-stable
cp $CI_PROJECT_DIR/requirements.txt $CI_PROJECT_DIR/rolling-hg/
for HG_BRANCH in default stable; do
DESTINATION=${CI_REGISTRY_IMAGE}/hg-${HG_BRANCH}:${TAG}
echo "Building with kaniko, pushing to ${DESTINATION}"
/kaniko/executor --context $CI_PROJECT_DIR/rolling-hg \
--dockerfile $CI_PROJECT_DIR/rolling-hg/Dockerfile \
--build-arg HG_BRANCH=${HG_BRANCH} \
--build-arg PYDEPS_TAG=${PYDEPS_TAG} \
--single-snapshot \
--cleanup \
--destination $DESTINATION
done
DESTINATION=${CI_REGISTRY_IMAGE}/hg-current:${TAG}
echo "Building with kaniko, pushing to ${DESTINATION}"
......
ARG PYDEPS_TAG
FROM octobus/ci-py3-hgext3rd as hgsrc
ARG HG_BRANCH
RUN hg pull -R /ci/repos/mercurial/ --rev ${HG_BRANCH} && \
hg -R /ci/repos/mercurial/ update ${HG_BRANCH} && \
hg -R /ci/repos/mercurial summary && \
hg clone -r ${HG_BRANCH} https://mirror.octobus.net/evolve /ci/repos/evolve && \
hg -R /ci/repos/evolve summary && \
mkdir -p /ci/tarballs && \
hg -R /ci/repos/mercurial archive -t tar /ci/tarballs/mercurial.tar && \
hg -R /ci/repos/evolve archive -t tar /ci/tarballs/evolve.tar
FROM registry.heptapod.net:443/heptapod/ci-images/fixed-pydeps:${PYDEPS_TAG}
COPY --from=hgsrc /ci/tarballs /root/tarballs
COPY requirements.txt /root/requirements.txt
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
&& \
pip3 install /root/tarballs/mercurial.tar && \
pip3 install /root/tarballs/evolve.tar && \
pip3 install -r /root/requirements.txt && \
apt-get remove -y build-essential python3-dev && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
# we'll need to squash anyway because of COPY
RUN rm -r /root/tarballs
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