Hi,
I’m trying to run a pipeline which creates a few docker containers with docker-compose and runs tests in one of them. When I run the pipeline with the shared runners the pipeline works as intended, however if I run it with my self-hosted runner I get an error that a file is missing from the container. I tried listing the directory in the container and I see that some of the project files are missing. I set up the pipeline to save the created docker image as an artifact, but when I load it locally (in the same environment where the runner is) the image appears to have all the files and the command that is failing actually runs successfully.
This is my .gitlab-ci.yml:
stages:
- build
- test
variables:
POSTGRES_USER: 'ecommerce724'
POSTGRES_PASSWORD: ''
POSTGRES_DB: 'test_ecommerce724'
POSTGRES_HOST_AUTH_METHOD: trust
build-test:
stage: build
image: docker/compose:1.29.2
tags:
- docker
services:
- docker:dind
script:
- docker-compose -f local.yml build
- docker save ecommerce724_local_django | gzip > ecommerce724_local_django.tar.gz
artifacts:
name: ecommerce724_local_django-image
paths:
- ecommerce724_local_django.tar.gz
expire_in: 2 days
pytest:
stage: test
needs: [build-test]
image: docker/compose:1.29.2
tags:
- docker
services:
- docker:dind
before_script:
- docker load -i ecommerce724_local_django.tar.gz
script:
- docker-compose -f local.yml up --build --force-recreate --detach
- docker-compose -f local.yml run --rm django python manage.py migrate
- docker-compose -f local.yml run django pytest
The pipeline fails when trying to run
docker-compose -f local.yml run --rm django python manage.py migrate
because manage.py is not found in the container. I suspect this is somehow an issue with my runner config but I have no clue how to verify that. This is my config.toml:
concurrent = 1
check_interval = 0
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "fricktop"
url = "https://gitlab.com"
id = some_id
token = RUNNER_TOKEN
executor = "docker"
health_checks_timeout = 120
[runners.custom_build_dir]
[runners.cache]
MaxUploadedArchiveSize = 0
[runners.cache.s3]
[runners.cache.gcs]
[runners.cache.azure]
[runners.docker]
tls_verify = false
image = "docker:stable"
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
shm_size = 0
wait_for_services_timeout = 120