Commit 6b7e7c0c 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 ` 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

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, so that's the compromise we chose.

In the future, we can also perhaps trigger from a periodic pull in or in the pull from
mercurial-mirror, building only for non trivial changes.
parent c050d19dae60
......@@ -23,7 +23,19 @@
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
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
echo "Building with kaniko, pushing to ${DESTINATION}"
FROM octobus/ci-py3-hgext3rd as hgsrc
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} /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
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