Commit 3b0848d1 authored by Georges Racinet's avatar Georges Racinet 🦑
Browse files

Heptapod CI: running tests needing services and file system access

Now that we have Omnibus support, we can just treat the Docker
container as any Omnibus instance.

We still have some permission issues to take care of, in order
not to run the full stack (including the web driver) as root.

Let's just hope it won't poison permissions for the other runs,
but if it does, that's not so hard to cure.

In some future, we could even run all CI tests this way, but for
now I think it's good to also test the Docker image from the
outside.

Closes #13

--HG--
branch : stable
parent b711b849302d
Pipeline #11081 waiting for manual action with stages
in 18 seconds
......@@ -28,4 +28,24 @@ docker-remote:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- when: manual # default case
docker-inside:
stage: test-heptapod
image: octobus/heptapod:$TARGET_HEPTAPOD_IMAGE
script:
- apt-get update
- apt-get -y install sudo
- visudo --file=ci/omnibus.sudoers -c
- install -m 0440 -o root -g root ci/omnibus.sudoers /etc/sudoers.d/omnibus
- apt-get -y install tox chromium-driver
- ci/run-tests-inside || ci/fail-copy-logs
artifacts:
when: on_failure
paths:
- log/gitlab-rails/production_json.log
- log/hgserve/mercurial.log
- log/hgserve/gunicorn.log
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- when: manual # default case
#!/bin/sh
# copy logs inside project so that they can be exposed
# as artifacts
mkdir -p log
cp /var/log/gitlab/*.log log/
# forward the failure
exit 1
\ No newline at end of file
git ALL=(ALL) NOPASSWD:/opt/gitlab/bin/gitlab-ctl
#!/bin/sh
set -e
# creating data and starting the application
# (we'll provide logs for failed jobs in another way, the general tailing
# that the wrapper script does is really too much clutter for the job log).
/assets/wrapper >/dev/null 2>&1 &
COMMON_FLAGS="-v \
--heptapod-url http://localhost:80 \
--heptapod-ssh-port 22 \
--heptapod-ssh-user git \
--heptapod-reverse-call-host=localhost \
--heptapod-omnibus"
chown -R git:git .
GIT_HOME=`ls -d ~git` # for explicit guaranteed forwarding
chown git:git $GIT_HOME
TOX="sudo -u git HOME=$GIT_HOME tox"
for MARKER in services fs_access; do
echo "Running functional tests marked with $MARKER"
if $TOX -- -m $MARKER $COMMON_FLAGS --heptapod-wait-after-first-response 180; then
echo "First pass for $MARKER succeeded"
else
echo "Rerunning failed tests of first pass for $MARKER"
$TOX -- -m $MARKER --lf $COMMON_FLAGS
fi
done
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