GitLab CI/CD
Pull Envshed secrets into your GitLab CI/CD jobs without copying them into project- or group-level CI/CD variables. One token in GitLab, every other secret stays in Envshed.
The first-class GitLab template (include-able job + .gitlab-ci.yml snippet) ships in Q3 2026. The CLI workaround below works today and is what we will recommend for self-managed GitLab once the template ships.
How it will work
- Single include — one
include: remote:line adds anenvshedjob that fetches secrets and exposes them to downstream jobs via adotenvartifact. - Token in one place — store
ENVSHED_TOKENonce as a masked, protected CI/CD variable; everything else lives in Envshed. - Per-environment mapping — pick the Envshed environment per pipeline using
ENVSHED_ENVIRONMENT, set inrules:or viadotenvfrom a previous job. - Self-managed safe — works against any GitLab version that supports
dotenvartifacts (13.0+), including self-hosted instances behind a VPN.
Workaround today
Use the envshed CLI directly inside your job. The dotenv artifact pattern below is the same one the future template will use under the hood.
variables:
ENVSHED_ENVIRONMENT: production
stages:
- secrets
- deploy
fetch-secrets:
stage: secrets
image: node:22-slim
script:
- npm install -g envshed
- envshed pull -e $ENVSHED_ENVIRONMENT -o my-org -p backend -f envshed.env --force
artifacts:
reports:
dotenv: envshed.env
deploy:
stage: deploy
needs: ["fetch-secrets"]
script:
- ./deploy.sh
A few notes on this pattern:
- Add
ENVSHED_TOKENas a masked, protected CI/CD variable so it is only available to protected branches and never echoed to logs. - Use a service token scoped to the environment you are deploying to — never a personal token.
- Prefer the
dotenvartifact pattern overcat envshed.env >> $GITLAB_ENV; the artifact pattern carries values into downstream jobs without writing them to a file other jobs can read.
Want this sooner?
The GitLab template waits behind the Vercel integration on the public roadmap. If GitLab CI is the integration that would unblock your team, email hello@envshed.com with a line about your GitLab version (SaaS or self-managed) — that helps us prioritize.
Related
- GitHub Actions — same idea, GitHub instead
- Docker — for jobs that build images
- Service tokens
- Public roadmap