English
Documentation
GitLab

GitLab Integration

OpenCode supports GitLab integration through CI/CD pipelines and GitLab Duo.

GitLab CI Integration

Use the community CI/CD component to run OpenCode in GitLab pipelines.

Setup

  1. Store credentials as masked CI variables
  2. Add component reference to .gitlab-ci.yml
include:
  - component: gitlab.com/opencode/[email protected]
 
opencode-job:
  extends: .opencode
  variables:
    OPENCODE_PROMPT: "Review this merge request"
    ANTHROPIC_API_KEY: $ANTHROPIC_API_KEY

Configuration

VariablePurpose
OPENCODE_PROMPTInitial prompt
OPENCODE_CONFIGCustom config path
OPENCODE_MODELModel to use

GitLab Duo Integration

Mention @opencode in comments to trigger AI assistance.

Capabilities

  • Issue triage and explanation
  • Bug fixes via branch creation
  • Merge request creation
  • Code review

Setup

  1. Configure GitLab environment variables
  2. Install dependencies (Node.js, glab CLI)
  3. Create flow configuration file
# .gitlab/opencode-flow.yml
name: opencode
triggers:
  - mention: "@opencode"
execution:
  command: opencode
  args:
    - run
    - "$COMMENT"

Features

  • Issue management
  • Merge request automation
  • CI/CD integration
  • Code review assistance

All operations execute on GitLab runners within your infrastructure.