Skip to content

gitlabMergeRequestState is not populated when triggered via webhook by a note #1823

@DarylMcBride

Description

@DarylMcBride

Summary:
When a Jenkins job is triggered by a GitLab Note webhook on a Merge Request, the environment variable gitlabMergeRequestState is not populated, even though the webhook payload includes the merge_request.state field.
This causes pipelines triggered by MR comments to lose context about the MR’s current state (opened, merged, closed), which breaks consistency with normal Merge Request event triggers.

What Operating System are you using (both controller, and any agents involved in the problem)?

N/A

Reproduction steps

  1. In GitLab, create a Merge Request.
  2. Add a comment (note) on the MR that triggers a Jenkins pipeline (via the GitLab plugin).
  3. In the Jenkinsfile, add:
pipeline {
  agent any
  stages {
    stage('debug') {
      steps {
        sh 'env | grep gitlabMergeRequest'
      }
    }
  }
}

Expected Results

gitlabMergeRequestState is missing

Actual Results

gitlabMergeRequestIid, gitlabSourceBranch, and gitlabTargetBranch is present but gitlabMergeRequestState is missing

Anything else?

No response

Are you interested in contributing a fix?

I think the change needs added here to include the merge request state

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions