Loading
Add graphql for workflow artifacts
What does this MR do and why?
Adds GraphQL functionality for workflow "linkables". Links between a workflow work_items for now. Followups will add merge requests, notes, and pipelines.
References
Closes #604024 (closed)
How to set up and validate locally
- Set up Duo Agent Platform
- Create links between a workflow and work item. You can go to an issue and ask
developerto create a new issue. This should created two links between the workflow and the source work item and the created work item. - Test out the below graphql queries:
Query 1: Get all workflows that were created FROM a work item:
query WorkflowsfromSource($workItemId: WorkItemID!) {
workItem(id: $workItemId) {
id
duoWorkflowLinks(linkType: SOURCE) {
nodes {
linkType
workflow {
id
title
}
}
}
}
} Query 2: Get all work items linked to a workflow:
query workflowLinkables {
duoWorkflowWorkflows(workflowId: "gid://gitlab/Ai::DuoWorkflows::Workflow/4561") {
nodes {
id
title
workItemLinks {
nodes {
linkType
workItem { id title }
}
}
}
}
} New scope
Here is the DB query when using the new scope:
SELECT "duo_workflows_workflow_work_items".* FROM "duo_workflows_workflow_work_items" WHERE "duo_workflows_workflow_work_items"."workflow_id" = 5304878 AND "duo_workflows_workflow_work_items"."link_type" = 0Execution Plan:
Index Scan using index_duo_wf_wf_wi_on_workflow_id_and_work_item_id on public.duo_workflows_workflow_work_items (cost=0.28..3.30 rows=1 width=58) (actual time=1.798..1.799 rows=0 loops=1)
Index Cond: ((duo_workflows_workflow_work_items.workflow_id = 5304878) AND (duo_workflows_workflow_work_items.link_type = 0))
Buffers: shared hit=3 read=2
Settings: effective_cache_size = '472585MB', jit = 'off', random_page_cost = '1.5', work_mem = '230MB', seq_page_cost = '4'DBLab Link with execution plan
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Roman Eisner