I would like to run the integration tests of a project furnished by a client. Said client provided me a list of tests and a Docker container (they didn't give me the Dockerfile though). I wanted to configure a GitLab runner to mount this Docker image but the image needs input parameters to be run, e.g.:
docker run --rm -it -u username -v $SCRIPT_DIR:/tests-folder $HOSTS $DOCKER_IMAGE
What it's doing is that it runs Docker in an interactive mode, mapping the current directory to the Docker image and specifies a host (against which the tests are performed).
However, to my knowledge it is not possible to configure a Docker GitLab runner to run with input parameters with the gitlab-runner register
command (those options should rather be in the Dockerfile as the ENTRYPOINT
or CMD
).
What I've tried so far is to register a Shell GitLab runner on the machine where the tests are hosted, run the Docker from within the .gitlab-ci.yml
file, and then launch the tests.
stages:
- test
integration-tests:
stage: test
tags:
- host-vm-shell
script:
- docker run --rm -it -u username -v $SCRIPT_DIR:/tests-folder $HOSTS $DOCKER_IMAGE
- robot test-1.robot
But when I do this, it launches the Docker image and immediately exits it, so when I try to run the tests, I'm back in the shell of the host VM.
Is there a way for me to launch this Docker container from within a Shell GitLab runner and launch my tests from within the container?