Duo Workflow: Add branch to GraphQL query

What does this MR do and why?

This change adds support for specifying which version (branch/commit) of a file to analyze when using GitLab's AI-powered Duo Workflow feature.

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. Enable the feature flag
Feature.enable(:duo_workflow_in_ci)
  1. In the Duo Workflow enabled project, create a file called Jenkinsfile, example content:
Example Jenkinsfile
pipeline {
    agent any

    stages {
        stage('Build') {
            steps {
                echo 'Building the application...'
                echo 'Compiling source code'
                echo 'Build completed successfully!'
                sh 'cat Jenkinsfile' // Display the content of the Jenkinsfile
                sh 'sleep 2' // Small delay to simulate work
            }
        }

        stage('Test') {
            steps {
                echo 'Running tests...'
                echo 'Unit tests passed'
                echo 'Integration tests passed'
                echo 'All tests completed successfully!'
                sh 'sleep 3' // Small delay to simulate work
            }
        }

        stage('Deploy') {
            steps {
                echo 'Deploying to staging environment...'
                echo 'Deployment in progress...'
                sh 'sleep 2' // Small delay to simulate work
                echo 'Application deployed successfully!'
            }
        }
    }

    post {
        success {
            echo 'Pipeline executed successfully!'
        }
        failure {
            echo 'Pipeline execution failed!'
        }
        always {
            echo 'This will always run, regardless of build status'
        }
    }
}
4. Open the just created file and verify the button "Convert to GitLab CI/CD" is present and in accordance with the screenshot.
  1. Click on the button, a pipeline should start if you have runners configured.

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)

Edited by Fred de Gier

Merge request reports

Loading