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
- Store credentials as masked CI variables
- 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_KEYConfiguration
| Variable | Purpose |
|---|---|
OPENCODE_PROMPT | Initial prompt |
OPENCODE_CONFIG | Custom config path |
OPENCODE_MODEL | Model 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
- Configure GitLab environment variables
- Install dependencies (Node.js, glab CLI)
- 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.