GitLab

Learn more about setting up Qodo on GitLab

Before you start

Installing Qodo on GitLab allows you to enhance merge requests with automated insights and improvements.

You can configure Qodo for a single repository to start small, or roll it out across multiple projects or groups for broader adoption. Setup typically takes just a few minutes, depending on whether you are using a webhook-based or CI pipeline-based approach.

Once configured, Qodo monitors merge requests, processes their content, and publishes actionable output—such as descriptions, reviews, and improvement suggestions—directly in your merge requests.

1. Log in to the Qodo portal

Before setting up Qodo, make sure you have created a Qodo account and signed in.arrow-up-right

2. Set up Qodo on GitHub

After signing in to your Qodo accountarrow-up-right, follow the steps below to set up Qodo on GitHub.

GitLab Repository

circle-check
  1. Generate a GitLab access token: Generate either a personal, project or group level access token, and store the token in a safe place.

    Make sure to enable the api scope in order to enable Qodo to read pull requests, comment and respond to requests.

  1. Generate a shared secret through Qodo registration page:

    1. Enter your generated GitLab token and your company or personal name in the appropriate fields and click Submit.

    2. A shared secret will be generated. Store it in a safe place.

  1. Install a GitLab webhook:

    1. Go to the Settings menu in your repository or groups, and click Webhooks.

    2. Click Add new webhook.

    3. In the webhook definition form, fill in the following fields:

      • URL: https://pro.gitlab.pr-agent.codium.ai/webhook

      • Secret token: Your Qodo key

      • Trigger: Check the Comments and Merge request events boxes.

      • SSL Verification: Check the Enable SSL verification box.

You’re all set. You can now start using Qodo.

circle-info

Visit our Usage Guide for next steps.

GitLab Pipeline

  1. Create a CI file: Create a new file named .gitlab-ci.yml with the content below:

  • This script will run Qodo on every new merge request.

    • You can modify the rules section to run Qodo on different events.

    • You can modify the script section to run different Qodo commands, or with different parameters by exporting different environment variables.

circle-info

Note: The $CI_SERVER_FQDN variable is available only from GitLab version 16.10.

If you're using an earlier version, you can combine the variables $CI_SERVER_HOST and $CI_SERVER_PORT to achieve the same result.

  1. Add masked variables: Go to CI/CD, then select Variables. In the masked variables section, add the following masked variables to your GitLab repository:

  • GITLAB_PERSONAL_ACCESS_TOKEN: Your GitLab personal access token.

  • OPENAI_KEY: Your Open AI key.

Don't set the variables as protected, or the pipeline will not have access to them.

You’re all set. You can now start using Qodo.

circle-info

Visit our Usage Guide for next steps.

GitLab webhook server

  1. Create a GitLab user In the group or project where you want to add Qodo, create a new GitLab user and assign it the Reporter role.

  2. Generate an access token Generate a personal_access_token for this user with api access enabled.

  3. Obtain a webhook secret Generate a random secret for your application and save it for later use as the shared_secret. You can use any secure secret generation tool you prefer.

  1. Clone this repository:

  1. Prepare variables and secrets:

    1. In the Qodo Merge configuration filearrow-up-right:

      • Set config.git_provider to "gitlab"

    2. In the secrets file/variables:

      • Set your AI model key in the respective section

      • In the [gitlab] section:

        • Set personal_access_token with the token from step 2.

        • Set shared_secret with the random secret from step 3.

  2. Build Docker image: Build a Docker image for the app. For example using Dockerhub:

  3. Set the environmental variables in the Docker image:

  1. Create webhook: Create a webhook in your GitLab project. Make sure to:

  • Set the URL to http[s]://<PR_AGENT_HOSTNAME>/webhook

  • Set the secret token to the generated secret from step 3.

  • Enable the triggers push, comments and merge request events.

You’re all set. You can now start using Qodo.

circle-info

Visit our Usage Guide for next steps.

Last updated