Skip to content
New Kodine v2 is now available

GitLab

Run Kodine from GitLab issues and merge requests.

Kodine fits into GitLab in two ways: inside a GitLab CI/CD pipeline, or through GitLab Duo.

Either way, execution happens on your own GitLab runners.


GitLab CI

Kodine runs as part of an ordinary GitLab pipeline, packaged as a CI component

The example below relies on the community-maintained CI/CD component nagyv/gitlab-kodine.


Features

  • Use custom configuration per job: Point each job at its own configuration directory, such as ./config/#custom-directory, to toggle functionality on a per-invocation basis.
  • Minimal setup: The component handles Kodine’s installation behind the scenes — you only supply the Kodine configuration and an initial prompt.
  • Flexible: A range of component inputs lets you tune how it behaves.

Setup

  1. Save your Kodine authentication JSON as a File type CI environment variable under Settings > CI/CD > Variables, flagged as “Masked and hidden”.

  2. Then extend your .gitlab-ci.yml file with the following.

    .gitlab-ci.yml
    include:
    - component: $CI_SERVER_FQDN/nagyv/gitlab-kodine/kodine@2
    inputs:
    config_dir: ${CI_PROJECT_DIR}/kodine-config
    auth_json: $KODINE_AUTH_JSON # The variable name for your Kodine authentication JSON
    command: optional-custom-command
    message: "Your prompt here"

The component catalog page covers the full input list and further scenarios — check out the docs.


GitLab Duo

With Duo, Kodine becomes part of your day-to-day GitLab flow. Tag @kodine in a comment, and the task executes inside your GitLab CI pipeline.


Features

  • Triage issues: Get Kodine to dig into an issue and walk you through it.
  • Fix and implement: Hand Kodine a bug or feature request. It branches, implements the change, and raises a merge request with the result.
  • Secure: All work happens on your own GitLab runners.

Setup

Since Kodine executes inside your GitLab CI/CD pipeline, getting it running involves these pieces:

  1. Prepare your GitLab environment

  2. Configure CI/CD

  3. Obtain an API key from an AI model provider

  4. Set up a service account

  5. Define the CI/CD variables

  6. Write a flow config file — here’s an example:

    Flow configuration
    image: node:22-slim
    commands:
    - echo "Installing kodine"
    - npm install --global @kodine/cli
    - echo "Installing glab"
    - export GITLAB_TOKEN=$GITLAB_TOKEN_KODINE
    - apt-get update --quiet && apt-get install --yes curl wget gpg git && rm --recursive --force /var/lib/apt/lists/*
    - curl --silent --show-error --location "https://raw.githubusercontent.com/upciti/wakemeops/main/assets/install_repository" | bash
    - apt-get install --yes glab
    - echo "Configuring glab"
    - echo $GITLAB_HOST
    - echo "Creating Kodine auth configuration"
    - mkdir --parents ~/.local/share/kodine
    - |
    cat > ~/.local/share/kodine/auth.json << EOF
    {
    "anthropic": {
    "type": "api",
    "key": "$ANTHROPIC_API_KEY"
    }
    }
    EOF
    - echo "Configuring git"
    - git config --global user.email "[email protected]"
    - git config --global user.name "Kodine"
    - echo "Testing glab"
    - glab issue list
    - echo "Running Kodine"
    - |
    kodine run "
    You are an AI assistant helping with GitLab operations.
    Context: $AI_FLOW_CONTEXT
    Task: $AI_FLOW_INPUT
    Event: $AI_FLOW_EVENT
    Please execute the requested task using the available GitLab tools.
    Be thorough in your analysis and provide clear explanations.
    <important>
    Please use the glab CLI to access data from GitLab. The glab CLI has already been authenticated. You can run the corresponding commands.
    If you are asked to summarize an MR or issue or asked to provide more information then please post back a note to the MR/Issue so that the user can see it.
    You don't need to commit or push up changes, those will be done automatically based on the file changes you make.
    </important>
    "
    - git checkout --branch $CI_WORKLOAD_REF origin/$CI_WORKLOAD_REF
    - echo "Checking for git changes and pushing if any exist"
    - |
    if ! git diff --quiet || ! git diff --cached --quiet || [ --not --zero "$(git ls-files --others --exclude-standard)" ]; then
    echo "Git changes detected, adding and pushing..."
    git add .
    if git diff --cached --quiet; then
    echo "No staged changes to commit"
    else
    echo "Committing changes to branch: $CI_WORKLOAD_REF"
    git commit --message "Codex changes"
    echo "Pushing changes up to $CI_WORKLOAD_REF"
    git push https://gitlab-ci-token:$GITLAB_TOKEN@$GITLAB_HOST/gl-demo-ultimate-dev-ai-epic-17570/test-java-project.git $CI_WORKLOAD_REF
    echo "Changes successfully pushed"
    fi
    else
    echo "No git changes detected, skipping push"
    fi
    variables:
    - ANTHROPIC_API_KEY
    - GITLAB_TOKEN_KODINE
    - GITLAB_HOST

Full details live in the GitLab CLI agents docs.


Examples

Here is what working with Kodine on GitLab looks like.

  • Explain an issue

    Post this comment on a GitLab issue.

    @kodine explain this issue

    Kodine reads the issue and posts back a clear explanation.

  • Fix an issue

    Write this on a GitLab issue:

    @kodine fix this

    Kodine creates a branch, applies the fix, and opens a merge request containing the changes.

  • Review merge requests

    Comment on a GitLab merge request like so:

    @kodine review this merge request

    Kodine goes through the merge request and leaves its feedback.