Skip to content

Conversation

@vglafirov
Copy link
Contributor

Replace Anthropic provider with native GitLab Duo integration:

  • Configure GitLab Duo provider with CI_JOB_TOKEN authentication
  • Add @gitlab/opencode-gitlab-plugin for GitLab API tools
  • Remove all custom CI/CD variables (ANTHROPIC_API_KEY, GITLAB_HOST, GITLAB_TOKEN_OPENCODE)
  • Use GitLab predefined variables (CI_JOB_TOKEN, CI_SERVER_HOST, CI_PROJECT_PATH)
  • Remove glab CLI dependency - plugin provides direct API access
  • Add 'Using GitLab Tools' section with practical examples
  • Update documentation link to opencode-gitlab-plugin
  • Simplify setup - zero custom configuration required

The configuration now uses only GitLab's built-in CI/CD variables and provides native integration with GitLab Duo for AI-powered assistance.

Replace Anthropic provider with native GitLab Duo integration:

- Configure GitLab Duo provider with CI_JOB_TOKEN authentication
- Add @gitlab/opencode-gitlab-plugin for GitLab API tools
- Remove all custom CI/CD variables (ANTHROPIC_API_KEY, GITLAB_HOST, GITLAB_TOKEN_OPENCODE)
- Use GitLab predefined variables (CI_JOB_TOKEN, CI_SERVER_HOST, CI_PROJECT_PATH)
- Remove glab CLI dependency - plugin provides direct API access
- Add 'Using GitLab Tools' section with practical examples
- Update documentation link to opencode-gitlab-plugin
- Simplify setup - zero custom configuration required

The configuration now uses only GitLab's built-in CI/CD variables and
provides native integration with GitLab Duo for AI-powered assistance.
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@vglafirov
Copy link
Contributor Author

cc: @nagyv Hi Viktor 👋 Don't you mind reviewing this? This is related to my recent PR: #7333

@rekram1-node
Copy link
Collaborator

lgtm but if yall have ur own process ill wait for Viktor to approve as well

@vglafirov
Copy link
Contributor Author

@rekram1-node I would double check with @nagyv before the merge, since it was his contribution. :)

@nagyv
Copy link
Contributor

nagyv commented Jan 14, 2026

@vglafirov While I understand that GitLab would like to push its GitLab Duo models and I think #7333 is a great addition to OpenCode, I consider this documentation change a step back to everyone who is not a GitLab Duo subscriber.

My recommendation: write the documentation so that both GitLab Duo users and non-users can use it. Thus the instructions should work not be exclusionary. More specifics in separate comments.

Copy link
Contributor

@nagyv nagyv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, I'm super happy that #7333 got merged, and I see no reason why we need both setups any more.

One of them uses a GitLab CI component, the other uses 100 lines of GitLab CI code to set up the same functionality. My recommendation is to merge the two sections, keeping the component approach at the core.

Let me know what you think about this @vglafirov

PS: I'm super happy to collaborate with you again :)

OpenCode integrates with your GitLab workflow through your GitLab CI/CD pipeline or with GitLab Duo.

In both cases, OpenCode will run on your GitLab runners.
OpenCode integrates with your GitLab workflow through CI/CD pipelines. OpenCode runs on your GitLab runners and uses GitLab Duo for AI-powered assistance.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OpenCode integrates with your GitLab workflow through CI/CD pipelines. OpenCode runs on your GitLab runners and uses GitLab Duo for AI-powered assistance.
OpenCode integrates with your GitLab workflow through CI/CD pipelines either with or without a GitLab Duo subscription. OpenCode runs on your GitLab runners and when available uses GitLab Duo for AI-powered assistance.

cat > ~/.local/share/opencode/auth.json << EOF
{
"anthropic": {
"gitlab": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the primary GitLab Duo specific part of the whole setup. If this is stored in an environment variable (with $ expansioin enabled), the much simpler setup presented above works out of the box.

I recommend merging this whole section into the previous one. I'm ok with presenting GitLab Duo auth config, and only mentioning to figure out the proper config for other providers.

}
EOF
- |
cat > opencode.json << EOF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating the whole opencode setup in CI, the CI component takes a config_dir input. Adding this config file there again simplifies the setup.

@nagyv
Copy link
Contributor

nagyv commented Jan 14, 2026

Btw, is my understanding correct that with #7333 merged,

once a GITLAB_TOKEN (possible =CI_JOB_TOKEN) env is set:

  • @gitlab/[email protected] - Provider implementation - need GitLab Duo subscription
  • @gitlab/[email protected] - OAuth/PAT authentication - valuable only if used with @gitlab/gitlab-ai-provider
  • @gitlab/[email protected] - GitLab API tools - the GITLAB_TOKEN will work for tool calls even if I don't use a Duo model (but go directly to Anthropic)

Thus except for the model selection the value of #7333 works without a GitLab Duo subscription too. Is this correct?

@vglafirov vglafirov closed this by deleting the head repository Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants