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

  1. Configure GDK to work with Duo Workflow: https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/duo_workflow.md
  2. In the Duo Workflow enabled project, create a new branch called dev add a file e.g. branch.md as an identifier.
  3. 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'
  1. A new branch was created, (see active branches http://gdk.test:3000/gitlab-duo/test/-/branches) with a name like workloads/<hash>
  2. Open the created branch and verify that the file branch.md is present, this proofs that the source_branch argument 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)

Merge request reports

Loading