I have been searching for ways to read a file with environment variables in GitLab CI/CD. Specifically they should be used in the services entry of a job.
variables:
# POSTGRES_USER: testuser
# POSTGRES_PASSWORD: testpw
# POSTGRES_DB: testdb
test:
image: python:3
services:
- name: postgis/postgis
I want to read the variables from a file stored in the same repository.
This can be achieved by the include keyword:
include: /test/postgis.yml
with /test/postgis.yml having these contents:
variables:
POSTGRES_USER: testuser
POSTGRES_PASSWORD: testpw
POSTGRES_DB: testdb
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With