Skip to Content
GuidesCI/CD Integration

CI/CD Integration

Restore your repo’s secret files in a pipeline with a read-only CI token and one command:

depvault pull

With DEPVAULT_TOKEN set, pull writes every file the token can read to its repo path, decrypted on the runner.


Replace “a whole .env in one CI secret”

A common pattern is pasting an entire .env into a single CI secret and writing it out at deploy time:

- run: echo "${{ secrets.DOCKER_ENV }}" > deploy/.env

The file has no history, no review, and drifts from what developers use. With DepVault, deploy/.env lives in the project like any other file (edited in the web app or pushed with the CLI), and the pipeline pulls it:

- uses: suxrobGM/depvault@v1 with: token: ${{ secrets.DEPVAULT_TOKEN }} - run: depvault pull deploy/.env

Create a token

  1. Open the project and go to Settings → CI/CD Tokens.
  2. Click Generate Token and fill in:
SettingDescription
Token namee.g. github-deploy.
FilesPath globs the token can read, matched from the repo root: deploy/**, apps/api/.env, or **/.env for every .env at any depth (.env alone is only the root file). Empty = every file.
Expires after1 hour to 1 year, or a custom date.
IP allowlistOptional IPs or CIDR ranges (Team plan).
  1. Unlock your vault if asked, generate, and copy the token. It is shown once, so store it as a secret in your CI provider (e.g. DEPVAULT_TOKEN).

Revoke tokens from the same page; revoked tokens are rejected immediately. Last use is shown for each token. Give each pipeline its own narrowly scoped token.

How the token stays zero-knowledge

A token looks like dvci_<auth>.<key>. The server only ever sees the auth part; the key part stays in your pipeline and unwraps the project key locally, so DepVault can authenticate the token but never decrypt your files. Details on the Encryption & Security page.


depvault pull in CI

depvault pull # every file the token can read depvault pull deploy/.env # only this file depvault pull 'apps/api/**' # only matching files
  • Files are written under the folder holding .depvault.json (so check out the repo first), or the current folder if there isn’t one.
  • No project ID, vault password, or login needed: the token determines the project.
  • CI tokens are read-only: push, status, and other commands refuse to run.
  • The command exits with code 1 if nothing matched or a file couldn’t be written. --json prints the written paths.
  • The installers and the action verify the downloaded CLI against the release’s SHA256SUMS.
  • depvault scan --fail-on high checks the checkout for leaked secrets without a token.

GitHub Actions

The suxrobGM/depvault action installs the CLI and sets DEPVAULT_TOKEN for later steps. It runs on Linux, macOS, and Windows runners (x64 and ARM64).

name: Deploy on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: suxrobGM/depvault@v1 with: token: ${{ secrets.DEPVAULT_TOKEN }} - run: depvault pull - run: npm ci && npm run build
InputDescriptionDefault
versionCLI version to install (e.g. v1.1.0).latest
tokenCI token; sets DEPVAULT_TOKEN.None

To expose a pulled .env to later steps as environment variables:

- run: cat apps/api/.env >> "$GITHUB_ENV"

GitLab CI

Store DEPVAULT_TOKEN as a masked CI/CD variable.

deploy: stage: deploy image: node:20 before_script: - curl -fsSL https://get.depvault.com | bash script: - depvault pull - npm ci && npm run build

Azure DevOps

Store the token as a secret pipeline variable.

steps: - script: curl -fsSL https://get.depvault.com | bash displayName: Install DepVault CLI - script: depvault pull displayName: Restore secret files env: DEPVAULT_TOKEN: $(DEPVAULT_TOKEN)

Windows without the action

- shell: pwsh run: irm https://get.depvault.com | iex - shell: pwsh env: DEPVAULT_TOKEN: ${{ secrets.DEPVAULT_TOKEN }} run: depvault pull

Docker builds

Don’t COPY restored secret files into an image, because they end up in its layers. Mount them as build secrets instead, or pass them at runtime (docker compose --env-file, env_file:):

depvault pull apps/api/.env docker build --secret id=env,src=apps/api/.env -t myapp .
FROM node:20-alpine AS build WORKDIR /app COPY . . RUN --mount=type=secret,id=env,target=/app/.env npm run build

Add the restored paths to .dockerignore so COPY . . can’t pick them up.


Troubleshooting

MessageFix
This token can't read any filesThe token’s Files globs match nothing. Check them in project settings.
No files matchedThe paths passed to pull are outside the token’s scope or don’t exist.
CI tokens can only pull filesOnly depvault pull works with a CI token.
401 UnauthorizedToken expired, revoked, or mistyped.
403 ForbiddenThe runner’s IP isn’t in the token’s allowlist.
not a valid CI tokenOld or mistyped token. Generate a new one.
CI token format not recognizedOld CLI. Run depvault update or use the latest action.