Flagsmith / Flagsmith/flagsmith

Code References: Add GitLab integration guides

Open
#7,133 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 13h
Merged PRs (30d)
121

Description

Context: https://github.com/Flagsmith/flagsmith/issues/7000

The Code References docs page only covers GitHub. We need a GitLab section so a developer can set this up in under five minutes.

### Scope

Add an "Integrate with GitLab" section to `docs/docs/managing-flags/code-references.md`, mirroring the existing GitHub section (simple + advanced). Update the info box (lines 17–21) that says GitHub-only.

### Simple configuration

The developer adds two [CI/CD variables](https://docs.gitlab.com/ci/variables/#define-a-cicd-variable-in-the-ui) to their GitLab project and one `include` to their `.gitlab-ci.yml`:

```yaml
include:
- remote: 'https://raw.githubusercontent.com/Flagsmith/ci/v1.0.0/templates/gitlab-ci.yml'
inputs:
flagsmith_project_id: "$FLAGSMITH_PROJECT_ID"
```

The two variables:
- `FLAGSMITH_PROJECT_ID` — from the Flagsmith dashboard URL (`/project//...`)
- `FLAGSMITH_CODE_REFERENCES_API_KEY` — from _Organisation Settings > API Keys_, set as [masked](https://docs.gitlab.com/ci/variables/#define-a-cicd-variable-in-the-ui) so it doesn't leak in job logs

Optionally set `FLAGSMITH_ADMIN_API_URL` for self-hosted Flagsmith instances (defaults to `https://api.flagsmith.com`).

### Advanced configuration

For teams that need to customise the pipeline (different stage, extra rules, multiple repos), show the full job definition that the template abstracts away. Use [`$CI_PROJECT_URL`](https://docs.gitlab.com/ci/variables/predefined_variables.html) for `repository_url` and [`$CI_COMMIT_SHA`](https://docs.gitlab.com/ci/variables/predefined_variables.html) for `revision`, and explain the mapping.

The simple config uses [`include:remote`](https://docs.gitlab.com/ci/yaml/#includeremote) with [`inputs:`](https://docs.gitlab.com/ci/yaml/#includeinputs) — the advanced config replaces that with an explicit job so the developer can change the [`image`](https://docs.gitlab.com/ci/yaml/#image), [`stage`](https://docs.gitlab.com/ci/yaml/#stages), or [`rules`](https://docs.gitlab.com/ci/yaml/#rules).

### Acceptance criteria

- [ ] Simple config is copy-pasteable with zero code modifications
- [ ] Advanced config shows the full job for customisation
- [ ] Self-hosted Flagsmith URL covered as optional override
- [ ] Links to same related pages as the GitHub section (Admin API Authentication, Flag Lifecycle)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.