5.2 KiB
| stage | group | info | title |
|---|---|---|---|
| AI-powered | Duo Workflow | Any user with at least the Maintainer role can merge updates to this content. For details, see https://docs.gitlab.com/ee/development/development_processes.html#development-guidelines-review. | Development of GitLab Duo Workflow |
How to set up the local development environment to run GitLab Duo Workflow.
Prerequisites
- GitLab Ultimate license
- Vertex access: You need access to the
ai-enablement-dev-69497ba7project in GCP because GDK by default uses Anthropic hosted on Vertex. Access to this project should be available to all engineers at GitLab.- If you do not have Vertex access for any reason, you should unset
DUO_WORKFLOW__VERTEX_PROJECT_IDin the Duo Workflow Service and setANTHROPIC_API_KEYto a regular Anthropic API key
- If you do not have Vertex access for any reason, you should unset
- Various settings and feature flags, which are enabled for you by the GDK setup script
Set up local development for Workflow
Workflow consists of four separate services:
- GitLab instance
- GitLab Duo Workflow Service
- GitLab Duo Workflow Executor
- GitLab Duo Workflow Webview
GDK Setup
You should set up GitLab Duo Workflow with the GitLab Development Kit (GDK) to run local versions of GitLab, Duo Workflow Service, and Executor.
This setup can be used with the publicly available version of the VS Code Extension. Follow these instructions to see the GitLab Duo Workflow UI local build in VS Code. A local build is required if you are making VS Code changes or need use an unreleased version.
Manual Setup
GitLab Duo Workflow UI in Visual Studio Code (VS Code)
There is no need for the GDK, Workflow service or Workflow executor local build to test the GitLab Duo Workflow UI.
Only set these up if you are making changes to one of them and need to test their integration with the GitLab Duo Workflow UI.
Refer to the GitLab Duo Workflow README file in the Language Server project to get started with local development of GitLab Duo Workflow UI.
Set up your local GitLab instance
-
Configure the GitLab Duo Workflow Service URL in your local GitLab instance by updating the
config/gitlab.ymlfile:development: duo_workflow: service_url: 0.0.0.0:50052 secure: false -
Restart the GitLab instance.
gdk restart rails -
In your local GitLab instance, enable the
duo_workflowfeature flag from the Rails console:Feature.enable(:duo_workflow) -
Set up GitLab Runner with GDK so you can create CI jobs locally to test Workflow.
-
Create a personal access token in your local GitLab instance with the
apiscope. Save this value and use it in the next step. -
Run GDK with an Ultimate license.
-
If you're running GitLab in SaaS mode, you'll need to turn on the
beta and experimental featuresfunctionality, as they are turned off by default. In the group settings for the project you'll run workflow against, ensure that theUse experiment and beta Duo featurescheckbox is checked. -
Manually create a Workflow using the following
curlrequest; the output will be a workflow ID that is referred to as$WORKFLOW_IDthroughout the rest of these docs:curl POST --verbose \ --header "Authorization: Bearer $YOUR_GITLAB_PAT" \ --header 'Content-Type: application/json' \ --data '{ "project_id": "$PROJECT_ID_FOR_RUNNING_WORKFLOW_AGAINST" }' \ $YOUR_GDK_ROOT_URL/api/v4/ai/duo_workflows/workflows
Set up the GitLab Duo Workflow Service and Executor
Refer to the GitLab Duo Workflow Service README and GitLab Duo Workflow Executor to set them up individually.
Troubleshooting
Issues connecting to 50052 port
JAMF may be listening on the 50052 port which will conflict with GitLab Duo Workflow Service.
$ sudo lsof -i -P | grep LISTEN | grep :50052
jamfRemot <redacted> root 11u IPv4 <redacted> 0t0 TCP localhost:50052 (LISTEN)
To work around this,run the serveron 50053 with:
PORT=50053 poetry run duo-workflow-service