Add source_branch option to start Duo Workflow
What does this MR do and why?
This change adds the ability to specify a custom source branch when running CI/CD workflows, instead of always using the default branch.
Previously, when creating a new branch for workflow execution, the system would always branch off from the project's default branch. The frontend can now pass along the actual branch being used.
References
Screenshots or screen recordings
| Before | After |
|---|---|
How to set up and validate locally
- Configure GDK to work with Duo Workflow: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/duo_workflow.md
- In the Duo Workflow enabled project, create a new branch called
devadd a file e.g.branch.mdas an identifier. - Run the following command to start a workflow:
curl -H "Private-Token: glpat-<redacted>" -XPOST 'http://127.0.0.1:3000/api/v4/ai/duo_workflows/workflows?project_id=1000000&start_workflow=true&goal=Create+a+file+called+hello.sh+that+prints+hello.&source_branch=dev'
- A new branch was created, (see active branches http://gdk.test:3000/gitlab-duo/test/-/branches) with a name like
workloads/<hash> - Open the created branch and verify that the file
branch.mdis present, this proofs that thesource_branchargument was used.
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.
Related to #544824 (closed)