> For the complete documentation index, see [llms.txt](https://docs.bugbug.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bugbug.io/integrations/gitlab.md).

# Gitlab

Discover seamless GitLab integration with BugBug. Run your test automation from GitLab CI/CD pipelines using our CLI.

### How to integrate test automation with GitLab?

BugBug can run tests from GitLab CI/CD pipelines using BugBug Command Line Interface.

Use this integration when you want GitLab to run BugBug tests before deployment or as part of merge request checks.

Keep in mind that cloud runs from CI/CD integrations are available on paid plans. More information about pricing can be found here: <https://bugbug.io/pricing/>

### Get your API token and suite ID

1. Go to the **Integrations** page.
2. Open the **CLI** tab.
3. Copy your API token or CLI setup command.
4. Find the suite or test you want to run.
5. Open its menu and select **Run via CLI or webhook**.
6. Copy the test ID or suite ID.

Store the project API token as a GitLab CI/CD variable, for example `BUGBUG_API_TOKEN`. Do not commit it to the repository. OAuth login is recommended for local CLI use, but CI jobs should use a project token from the secret manager.

### Example GitLab pipeline

Add a job like this to `.gitlab-ci.yml`:

```yaml
bugbug_tests:
  image: node:24
  stage: test
  script:
    - npm install -g @bugbug-io/cli
    - bugbug --ci suites run <suite-id>
  only:
    - main
```

Set `BUGBUG_API_TOKEN` in **Settings > CI/CD > Variables** in GitLab.

### Use Public API or incoming webhooks

Use the Public API if your GitLab pipeline needs advanced control, such as checking run status, stopping runs, or downloading reports.

Use incoming webhooks if GitLab only needs to trigger a run with one `POST` request.

BugBug does not require a native GitLab OAuth connection for this flow.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.bugbug.io/integrations/gitlab.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
