Files
infisical/docs/integrations/cicd/gitlab.mdx
2025-11-24 19:59:00 -03:00

45 lines
1.6 KiB
Plaintext

---
title: "GitLab"
description: "How to sync secrets from Infisical to GitLab"
---
Prerequisites:
- Set up and add envars to [Infisical Cloud](https://app.infisical.com).
<AccordionGroup>
<Accordion title="Standard">
Use our [GitLab Secret Syncs](../secret-syncs/gitlab)
</Accordion>
<Accordion title="Pipeline">
<Steps>
<Step title="Authorize Infisical for GitLab">
Generate an [Infisical Token](/documentation/platform/token) for the specific project and environment in Infisical.
Next, create a new variable called `INFISICAL_TOKEN` with the value set to the token from the previous step in Settings > CI/CD > Variables of your GitLab repository.
</Step>
<Step title="Configure Infisical in your pipeline">
Edit your `.gitlab-ci.yml` to include the Infisical CLI installation. This will allow you to use the CLI for fetching and injecting secrets into any script or command within your Gitlab CI/CD process.
#### Example
```yaml
image: ubuntu
stages:
- build
- test
- deploy
build-job:
stage: build
script:
- apt update && apt install -y curl
- curl -1sLf 'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash
- apt-get update && apt-get install -y infisical
- infisical run -- npm run build
```
</Step>
</Steps>
</Accordion>
</AccordionGroup>