Skip to content

Using environment variables from host into CI with dind service

Hey guys, first of all I want to congratulate you on giving us such an amazing tool.

For security reasons I want to use the host's environment variables inside our CI but I can't seem to make it work. I'm using a dummy repository with the following ci file:

image: python:3.7


services:
  - docker:dind


stages:
  - deploy-prod


deploy-prod:
  stage: deploy-prod
  when: manual
  script:
    - echo "$ENV_VAR" # comes out empty
    - echo "It worked"
  environment:
    name: production

And I'm glad with any help or guidance you guys can give me, have a nice day.

Edited by Yuri Araújo