N
N
neothesilent2016-08-10 11:09:15
linux
neothesilent, 2016-08-10 11:09:15

How to run tests using Docker socket binding?

Hello!
There are Gitlab CI and Gitlab CI Multi Runners. Now it is configured so that the tests are run through the shell executor on the machine where Gitlab CI Multi Runner is installed, the tests are run for the website in the root of the repository.
I tried all options docs.gitlab.com/ce/ci/docker/using_docker_build.html except, dind, and working only using docker private registry, you need to first build the image through the Dockerfile then push it to the registry and use this image when building . Example:

image: my-registry:5000/my-image:latest

before_script:
 - yum -y update
 - composer self-update

job:
  script:
    - composer install
    - npm install
    - ./node_modules/.bin/bower install
    - ./php_packages/squizlabs/php_codesniffer/scripts/phpcs ...
    - ./php_packages/sebastian/phpcpd/phpcpd ...
    - npm test

Competitive builds also work in this vein, if you configure concurrency. But there is another way using docker socket bind:
image: docker:latest

before_script:
- docker info

build:
  stage: build
  script:
  - docker build -t my-docker-image .
  - docker run my-docker-image /script/to/run/tests

I wanted to use it, since rebuilding the image through the Dockerfile before the build is more correct than using the image from the register, which must be manually updated every time, but when using docker socket bind, I can not figure out how to run tests using docker run my-docker-image /script/to/run/tests , since the tests need to be run in the root of the repository, and it simply does not exist in this container. Those I can take out the tests in a separate script, but I need to run them in the root of the repository.
What is the best method to run tests on the root of a repository using parallel builds and docker executor? Is there a way to run my tests for the repository using docker socket bind?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question