How to use exec command with the dockerized version of gitlab-runner
Summary
Trying to debug a failing gitlab ci job by using the docker gitlab-runner exec functionality. But it fails right away by complaining that it cannot find the local git repository:
[project-root]$ docker run --rm -t -i gitlab/gitlab-runner exec docker test
Runtime platform arch=amd64 os=linux pid=6 revision=5a147c92 version=11.11.1
Not a git repository
To compare two paths outside a working tree:
usage: git diff [--no-index] <path> <path>
WARNING: You most probably have uncommitted changes.
WARNING: These changes will not be tested.
fatal: Not a git repository (or any of the parent directories): .git
FATAL: exit status 128
[project-root]$
But obviously there is a git repo (and .gitlab-ci.yml) in the same directory.
It is the first time that I'm trying to use gitlab-runner locally. So no later or earlier config/caching stuff which could have f*ked it up. Ubuntu 18.04.
Steps to reproduce
docker run --rm -t -i gitlab/gitlab-runner exec docker test
Gitlab ci yaml is not relevant I think because the problem happens before the parser reads the yaml.
.gitlab-ci.yml
variables:
GIT_SSL_NO_VERIFY: "1"
APP_ENV: "ci"
image: gitlab.servers.kantoor.eztrack.nl:4567/platform/laguna:latest
stages:
- test
- build
- trigger integration test
- deploy dev
- deploy test
test:
stage: test
services:
- mysql:5.7
- mongo:3.6
variables:
MYSQL_DATABASE: "ci"
MYSQL_ROOT_PASSWORD: "root"
cache:
key: "test"
paths:
- vendor/
before_script:
- export COMPOSER_ALLOW_SUPERUSER=1
- /usr/local/bin/composer install --no-interaction --no-progress --no-scripts
- ./artisan odm:clear-cache:metadata
- ./artisan odm:generate:proxies
- ./artisan odm:generate:hydrators
- ./artisan clear-compiled
- ./artisan cache:clear
- ./artisan config:clear
- ./artisan doctrine:clear:metadata:cache
- ./artisan doctrine:generate:proxies
- /usr/local/bin/composer dumpautoload
- ./artisan doctrine:migrations:migrate
script:
- ./vendor/bin/phpunit
Used GitLab Runner version
11.11.1
Edited by Steve Xuereb