|
| 1 | +--- |
| 2 | +title: GitLab Integration |
| 3 | +description: Link GitLab issues and merge requests to Flagsmith feature flags |
| 4 | +sidebar_label: GitLab |
| 5 | +hide_title: true |
| 6 | +--- |
| 7 | + |
| 8 | +<img src="/img/integrations/gitlab/gitlab-logo.svg" alt="GitLab Logo" width="30%" /> |
| 9 | + |
| 10 | +Link GitLab issues and merge requests to your Flagsmith feature flags. When a |
| 11 | +flag changes state, Flagsmith posts a comment to the linked issue or MR showing |
| 12 | +the flag's current state across all environments. |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +## Setup |
| 17 | + |
| 18 | +The integration supports |
| 19 | +[personal access tokens](https://docs.gitlab.com/user/profile/personal_access_tokens/), |
| 20 | +[group access tokens](https://docs.gitlab.com/user/group/settings/group_access_tokens/), |
| 21 | +and [project access tokens](https://docs.gitlab.com/user/project/settings/project_access_tokens/). |
| 22 | +All require the `api` scope. The token type determines which projects are |
| 23 | +accessible in Flagsmith. |
| 24 | + |
| 25 | +1. **In GitLab** |
| 26 | + 1. Create an access token with the `api` scope. |
| 27 | + 1. Copy the token — you will not see it again. |
| 28 | +1. **In Flagsmith** |
| 29 | + 1. Go to Integrations > **GitLab** > Add Integration. |
| 30 | + 1. Set the **GitLab Instance URL** to your instance |
| 31 | + (e.g. `https://gitlab.example.com` or `https://gitlab.com`). |
| 32 | + 1. Paste the access token. |
| 33 | + 1. Click "Save". ✅ |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +:::tip |
| 38 | + |
| 39 | +Remember to rotate your GitLab access token before it expires. |
| 40 | + |
| 41 | +::: |
| 42 | + |
| 43 | +## Linking issues and merge requests to feature flags |
| 44 | + |
| 45 | +1. Open a feature flag and go to the **Links** tab. |
| 46 | +1. Select a GitLab project. |
| 47 | +1. Choose **Issue** or **Merge Request**. |
| 48 | +1. Search and select the item you want to link. |
| 49 | + |
| 50 | + |
| 51 | + |
| 52 | +Flagsmith will post a comment to the linked issue or MR with the flag's current |
| 53 | +state across all environments. When the flag state changes, a new comment is |
| 54 | +posted automatically. |
| 55 | + |
| 56 | +A **Flagsmith Flag** label is added to linked issues and merge requests so your |
| 57 | +team can filter for them in GitLab. |
| 58 | + |
| 59 | +## Automatic state sync |
| 60 | + |
| 61 | +When a linked issue or merge request changes state in GitLab — closed, merged, |
| 62 | +or reopened — Flagsmith automatically updates the linked feature flag's tags to |
| 63 | +reflect the current state. This is powered by webhooks that Flagsmith registers |
| 64 | +on your GitLab projects automatically. |
| 65 | + |
| 66 | +## Removing the integration |
| 67 | + |
| 68 | +Go to Integrations > GitLab > Manage Integration > Delete Integration. |
0 commit comments