summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Read <eread@gitlab.com>2019-07-15 06:14:52 +0000
committerEvan Read <eread@gitlab.com>2019-07-15 06:14:52 +0000
commitdd8c993b53d9f41c93748b469d5639a18ac058a5 (patch)
tree21d665ff804c409db4ced3c8bec1da815d5ece0f
parent283361f53760d90ee7bd605e11033d8999957dfb (diff)
parent5bef1dc841c5357f5f2900fa9c7895f8b6f48add (diff)
downloadgitlab-ce-dd8c993b53d9f41c93748b469d5639a18ac058a5.tar.gz
Merge branch 'patch-46' into 'master'
Add example of ENV variables for image and services. See merge request gitlab-org/gitlab-ce!27320
-rw-r--r--doc/ci/docker/using_docker_images.md36
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md
index 2d7fb323d79..90565efe196 100644
--- a/doc/ci/docker/using_docker_images.md
+++ b/doc/ci/docker/using_docker_images.md
@@ -249,6 +249,42 @@ test:
- bundle exec rake spec
```
+## Passing environment variables to services
+
+You can also pass custom environment [variables](../variables/README.md)
+to fine tune your Docker `images` and `services` directly in the `.gitlab-ci.yml` file.
+For more information, see [custom environment variables](../variables/README.md#gitlab-ciyml-defined-variables)
+
+```yaml
+# The following variables will automatically be passed down to the Postgres container
+# as well as the Ruby container and available within each.
+variables:
+ HTTPS_PROXY: "https://10.1.1.1:8090"
+ HTTP_PROXY: "https://10.1.1.1:8090"
+ POSTGRES_DB: "my_custom_db"
+ POSTGRES_USER: "postgres"
+ POSTGRES_PASSWORD: "example"
+ PGDATA: "/var/lib/postgresql/data"
+ POSTGRES_INITDB_ARGS: "--encoding=UTF8 --data-checksums"
+
+services:
+- name: postgres:9.4
+ alias: db
+ entrypoint: ["docker-entrypoint.sh"]
+ command: ["postgres"]
+
+image:
+ name: ruby:2.2
+ entrypoint: ["/bin/bash"]
+
+before_script:
+- bundle install
+
+test:
+ script:
+ - bundle exec rake spec
+```
+
## Extended Docker configuration options
> Introduced in GitLab and GitLab Runner 9.4.