Skip to content

Conversation

@bluesky-adi
Copy link

What does this PR do?

Populates the gitlabMergeRequestState environment variable for Jenkins
builds triggered by GitLab Merge Request note (comment) webhooks.
This brings note-triggered builds in line with merge request event triggers.

Testing done

Manual reasoning-based validation.

  • Compared NoteHookTriggerHandlerImpl with MergeRequestHookTriggerHandlerImpl
  • Verified that merge request event handler already populates
    mergeRequestState in CauseData
  • Applied the same field population for note-triggered builds
  • Change is deterministic and uses data already present in the webhook payload

Automated tests were not added because:

  • The project currently lacks isolated unit tests for webhook trigger handlers
  • Setting up Jenkins + GitLab webhook simulation is non-trivial
  • The change mirrors existing, production-tested logic

Related issue

Fixes #1823

@bluesky-adi bluesky-adi requested a review from a team as a code owner December 14, 2025 21:51
@bluesky-adi
Copy link
Author

Thanks for the review opportunity!

The failing CI appears unrelated to this change (no tests were modified or added).
This PR only adds mergeRequestState population using existing webhook payload data,
mirroring logic already present in MergeRequestHookTriggerHandlerImpl.

Happy to rebase or adjust if you’d like me to handle CI locally or add a safeguard.

@bluesky-adi
Copy link
Author

Thanks for the update.

This change is logic-only and mirrors existing behavior from
MergeRequestHookTriggerHandlerImpl.

The CodeQL failure appears to be related to Java autobuild
limitations for Jenkins plugins rather than this change itself.

Happy to adjust or add guidance if a specific build step
is preferred by maintainers.

@krisstern krisstern added the bug For changelog: Minor bug. Will be listed after features label Dec 29, 2025
@krisstern
Copy link
Member

I am actually seeing the following in the logs:

10:34:45  [ERROR] COMPILATION ERROR : 
10:34:45  [INFO] -------------------------------------------------------------
10:34:45  [ERROR] /home/jenkins/agent/workspace/Plugins_gitlab-plugin_PR-1848/src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/note/NoteHookTriggerHandlerImpl.java:[89,71] incompatible types: com.dabsquared.gitlabjenkins.gitlab.hook.model.State cannot be converted to java.lang.String

@krisstern
Copy link
Member

Did you actually test this change locally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gitlabMergeRequestState is not populated when triggered via webhook by a note

2 participants