How do I mount a volume in a docker container in .gitlab-ci.yml?

后端 未结 1 1656
孤独总比滥情好
孤独总比滥情好 2020-12-31 14:26

I\'m using .gitlab-ci.yml and docker as a GitLab CI runner on an Android project. At the end of the test run, gradlew saves test results in xml and

相关标签:
1条回答
  • I would advice against mounting volumes from the host for your CI. If you really want to, you have to configure the runner accordingly (config.toml). If you are using shared runners you never know on what system a particular build is going to be executed.

    I think the better solution would be to define the test-results as artifacts.

    That way, the test-results are available for older builds and not only the latest build.

    Below you can find the configuration (config.toml) of my runner I use for building docker-images. You can replace /var/run/docker.sock by the directory you want your build-results to end up in.

    [[runners]]
      name = "Docker"
      url = "https://mygitlab/ci"
      token = "mytoken"
      executor = "docker"
      [runners.docker]
        tls_verify = false
        image = "docker:latest"
        privileged = false
        disable_cache = false
        volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]
      [runners.cache]
        Insecure = false
    
    0 讨论(0)
提交回复
热议问题