feat: Send the workload user's email with the start flow request

What does this MR do and why?

This MR adds the StartWorkflowRequest's workload_user 's (the user triggering the workflow or the service account, if enabled) email address to the request as an ENV variable. The priority for which email to use is commit email > email > static default email.

References

gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#1487 (closed)

gitlab-org/duo-workflow/duo-workflow-executor!239 (merged)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Enable the composite identity FF
Feature.enable(:duo_workflow_use_composite_identity)
  1. Add this file to the repository at .gitlab/duo/agent-config.yml
setup_script:
  - echo "$DUO_WORKFLOW_GIT_USER_EMAIL".  # To verify the email address
  - exit 0                                # To skip the actual workflow execution
  1. Start a new workflow
curl --location 'http://gdk.test:3000/api/v4/ai/duo_workflows/workflows' \
 --header 'Content-Type: application/json' \
 --header 'PRIVATE-TOKEN: $TOKEN' \
 --data '{
     "project_id": "1000000",
     "goal": "JenkinsFile",
     "workflow_definition": "convert_to_gitlab_ci",
     "start_workflow": true
 }'
  1. Verify that the service accounts email is present

    Screenshot 2025-09-29 at 16.14.07.png

  2. Disable the composite identity FF

Feature.disable(:duo_workflow_use_composite_identity)
  1. Repeat step 3, this time, the user's email address will be there

    Screenshot_2025-09-29_at_16.14.00

  2. Change the user's commit email (preferences -> profile -> main settings) and verify that it changes in the output as well

    Screenshot_2025-09-29_at_17.01.28

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 gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#1487 (closed)

Edited by Andras Herczeg

Merge request reports

Loading