Read about our upcoming Code of Conduct on this issue

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

CI: new data bootstrapped image

The idea is that the initialization that occurs so far
in all our CI jobs is lengthy and resource intensive: it accounts
to about 5 minutes per job.

For true installations, it makes sense to perform these steps with
an initial configuration that's already as intended. But for our
tests, the result is always the same for a given base image.

Because the affected directories are volumes, we need to copy the
result elsewhere on the filesystem, so that they aren't discarded
immediately.

In turn, the wrapper script used in the bootstrapped image restores
them to the volumes and performs a much simpler startup sequence.

The base image to use is entirely passed as an ARG, but it will
typically be called by CI, perhaps with a hash-based tag.
parent 7ef57c021091
ARG heptapod_image
FROM $heptapod_image
COPY bootstrapped-wrapper /assets/
# The wrapper script already takes care of all data initialisation
# we just remove the lines that never return. This is better than
# making our own version that will certainly later diverge from
# upstream GitLab.
# Sometimes `gitlab-ctl stop` can fail, in that case we insist once
# and then proceed, letting the build container termination kill it
# for good. It's been seen for hgitaly only so far. What matters is
# clean termination of postgresql.
RUN grep -Ev '^wait|gitlab-ctl tail' /assets/wrapper > /assets/bootstrap && \
chmod 755 /assets/bootstrap && \
chmod 755 /assets/bootstrapped-wrapper && \
/assets/bootstrap && \
( gitlab-ctl stop || gitlab-ctl stop || /bin/true ) && \
rsync -aHX /etc/gitlab/ /etc/gitlab-bootstrapped && \
rsync -aHX /var/opt/gitlab/ /var/opt/gitlab-bootstrapped && \
rsync -aHX /var/log/gitlab/ /var/log/gitlab-bootstrapped
CMD ["/assets/bootstrapped-wrapper"]
#!/bin/sh
set -e
echo "Retrieving data and config from the bootstrapping done in base image"
rsync -aHX /etc/gitlab-bootstrapped/ /etc/gitlab
rsync -aHX /var/opt/gitlab-bootstrapped/ /var/opt/gitlab
# here we probably only need the directory structure, we'll see
# to trim this down in the image later
rsync -aHX /var/log/gitlab-bootstrapped/ /var/log/gitlab
# everything being prepared, we don't need to create gitlab.rb,
# reconfigure or create ssh keys etc
echo "Starting service manager..."
GITLAB_OMNIBUS_CONFIG= /opt/gitlab/embedded/bin/runsvdir-start &
echo "Starting services..."
gitlab-ctl start
# Tail all logs
gitlab-ctl tail &
# Wait for SIGTERM
wait
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