Code Suggestions on self-managed GitLab (PREMIUM SELF)
- Introduced in GitLab 16.1 as Beta on self-managed GitLab.
- Introduced support for Google Vertex AI Codey APIs in GitLab 16.1.
- Removed support for GitLab native model in GitLab 16.2.
- Code Suggestions in the GitLab WebIDE enabled for all GitLab-hosted customers.
- Generally available in GitLab 16.7.
Write code more efficiently by using generative AI to suggest code while you're developing.
GitLab Duo Code Suggestions are available on GitLab Enterprise Edition.
Code Suggestions are not available for GitLab Community Edition.
In GitLab 16.3 and later, to participate in the free trial of Code Suggestions on self-managed GitLab, you must:
- Be a Premium or Ultimate customer.
- Have activated cloud licensing.
Usage of Code Suggestions is governed by the GitLab Testing Agreement. Learn about data usage when using Code Suggestions.
Enable Code Suggestions on self-managed GitLab
- Introduced in GitLab 16.1 as Beta.
- Enabled self-managed in GitLab 16.8.
When you enable Code Suggestions for your self-managed instance, you:
- Agree to the GitLab testing agreement.
- Acknowledge that GitLab sends data from the instance, including personal data, to GitLab.com infrastructure.
How you enable Code Suggestions for your instance differs depending on your version of GitLab. This setting is visible only in self-managed GitLab instances.
::Tabs
:::TabTitle GitLab 16.3 and later
Prerequisites:
- You are a new Code Suggestions customer as of GitLab 16.3.
- All of the users in your instance have the latest version of their IDE extension.
- You are an administrator.
To enable Code Suggestions for your self-managed GitLab instance:
- On the left sidebar, at the bottom, select Admin Area.
- Select Settings > General.
- Expand Code Suggestions and select Turn on Code Suggestions for this instance. In GitLab 16.3, you do not need to enter anything into the Personal access token field. In GitLab 16.4 and later, there is no Personal access token field.
- Select Save changes.
- To make sure Code Suggestions works immediately, you must manually synchronize your subscription.
The users in your instance can now use Code Suggestions.
:::TabTitle GitLab 16.2 and earlier
FLAG: On self-managed GitLab 16.0 and earlier, GitLab Duo Code Suggestions is not available. To use this feature, you must have GitLab 16.1 or later. For optimal performance and full feature access, you should upgrade to GitLab 16.3 or later, which supports cloud licensing.
Prerequisites:
- You are an administrator.
- You have a customer success manager.
- You have a GitLab SaaS account. You do not need to have a GitLab SaaS subscription.
NOTE: If you do not have a customer success manager, you cannot participate in the free trial of Code Suggestions on self-managed GitLab. Upgrade to GitLab 16.3 or later to perform self-service onboarding.
Then, you will:
- Enable Code Suggestions for your SaaS account.
- Enable Code Suggestions for the instance.
- Request early access to the Code Suggestions Beta.
Enable Code Suggestions for your SaaS account
To enable Code Suggestions for your GitLab SaaS account:
- Create a personal access token
with the
api
scope. - On the left sidebar, select your avatar.
- Select Preferences.
- In the Code Suggestions section, select Enable Code Suggestions.
- Select Save changes.
Enable Code Suggestions for the instance
To enable Code Suggestions for your self-managed GitLab instance:
- On the left sidebar, at the bottom, select Admin Area.
- Select Settings > General.
- Expand Code Suggestions and:
- Select Turn on Code Suggestions for this instance.
- In Personal access token, enter your GitLab SaaS personal access token.
- Select Save changes.
This setting is visible only in self-managed GitLab instances.
WARNING: If you clear the Turn on Code Suggestions for this instance checkbox, the users in your instance can still use Code Suggestions for up to one hour, until the issued JSON web token (JWT) expires.
::EndTabs
Request access to Code Suggestions
GitLab provisions access on a customer-by-customer basis for Code Suggestions on self-managed instances. To request access, contact your customer success manager.
Your customer success manager then provisions access by commenting on issue 415393 (internal access only).
After GitLab has provisioned access to Code Suggestions for your instance, the users in your instance can now enable Code Suggestions.
Configure network and proxy settings
Configure any firewalls to allow outbound connections to https://codesuggestions.gitlab.com/
.
If your GitLab instance uses an HTTP proxy server to access the internet, ensure
the server is configured to allow outbound connections, including the
gitlab_workhorse
environment variable.
Upgrade GitLab
In GitLab 16.3 and later, GitLab is enforcing the cloud licensing requirement for Code Suggestions:
- The Premium and Ultimate subscription tiers support cloud licensing.
- GitLab Free does not have cloud licensing support.
If you have a GitLab Free subscription and upgrade to GitLab 16.3 or later, to continue having early access to Code Suggestions, you must:
- Have a subscription that supports cloud licensing.
- Make sure you have the latest version of your IDE extension.
- Manually synchronize your subscription.
Manually synchronize your subscription
You must manually synchronize your subscription if either:
- You have already upgraded to GitLab 16.3 and have just bought a Premium or Ultimate tier subscription.
- You already have a Premium or Ultimate tier subscription and have just upgraded to GitLab 16.3.
Without the manual synchronization, it might take up to 24 hours to active Code Suggestions on your instance.
Use Code Suggestions
Prerequisites:
- You must have a supported IDE editor extension.
- Code Suggestions must be enabled for your instance.
To use Code Suggestions:
- Author your code. As you type, suggestions are displayed. Code Suggestions provide code snippets or complete the current line, depending on the cursor position.
- Describe the requirements in natural language. Be concise and specific. Code Suggestions generates functions and code snippets as appropriate.
- To accept a suggestion, press Tab.
- To ignore a suggestion, keep typing as you usually would.
- To explicitly reject a suggestion, press Esc.
Things to remember:
- AI is non-deterministic, so you may not get the same suggestion every time with the same input.
- Just like product requirements, writing clear, descriptive, and specific tasks results in quality generated code.
Data privacy
A self-managed GitLab instance does not generate the code suggestion. After successful authentication to the self-managed instance, a token is generated.
The IDE/editor then uses this token to securely transmit data directly to GitLab.com's Code Suggestions service via the Cloud Connector gateway service for processing.
The Code Suggestions service then securely returns an AI-generated code suggestion.
Neither GitLab nor Google Vertex AI Codey APIs have any visibility into a self-managed customer's code other than what is sent to generate the code suggestion.
Disable Code Suggestions
Individual users can disable Code Suggestions by disabling the feature in their installed IDE editor extension.