GitLab + Doppler CLI
Bring new features and workflows to how you manage GitLab CI/CD variables with Doppler.
In this guide, you'll learn how to use the Doppler CLI to inject secrets as environment variables into your scripts and commands.
Prerequisites
You have a GitLab repository with permissions for viewing and modifying CI / CD job variables
Doppler Project
Create a Doppler Project with a custom GitLab environment.
![Create-Gitlab-Environment.gif 1072](https://files.readme.io/52dd3e6-Create-Gitlab-Environment.gif)
Service Token
Create a Service Token for the GitLab environment to provide the Doppler CLI with read-only secrets access and copy the Service Token value.
![CleanShot 2022-04-05 at 12.12.54@2x.png 1600](https://files.readme.io/842c3c1-CleanShot_2022-04-05_at_12.12.542x.png)
In GitLab, go to Settings > CI/CD > Variables and create a new DOPPLER_TOKEN variable with the Service Token value.
![CleanShot 2022-04-05 at 12.14.25@2x.png 1600](https://files.readme.io/104b903-CleanShot_2022-04-05_at_12.14.252x.png)
Configure Pipeline
Update your .gitlab-ci.yml
to install the Doppler CLI and use doppler run
to inject secrets as environment variables into any script or command:
image: ubuntu
build:
stage: build
script:
- apt update && apt install -y curl gnupg
- curl -Ls --tlsv1.2 --proto "=https" --retry 3 https://cli.doppler.com/install.sh | sh
- doppler run -- ./bin/build.sh
Amazing Work!
Now you know how to configure GitLab CI / CD jobs to fetch secrets from Doppler.
Updated 4 months ago