Skip to content

[JENKINS-76185] Add GitLab merge request compatibility#170

Open
BartVerc wants to merge 5 commits intojenkinsci:masterfrom
BartVerc:feat/gitlab-mr
Open

[JENKINS-76185] Add GitLab merge request compatibility#170
BartVerc wants to merge 5 commits intojenkinsci:masterfrom
BartVerc:feat/gitlab-mr

Conversation

@BartVerc
Copy link
Copy Markdown

@BartVerc BartVerc commented Oct 10, 2025

As mentions in JENKINS-76185, I want to make it possible to use this plugin with Gitlab Merge Requests as well.

I would like to know if I missed something somewhere, as I am not yet familiar with this code base.

Testing done

I tested it by running all the tests by mvn test.
Did not yet test it manually.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

@BartVerc BartVerc requested a review from a team as a code owner October 10, 2025 11:56
@MarkEWaite MarkEWaite added the enhancement Improvement or new feature label Oct 10, 2025
@MarkEWaite MarkEWaite changed the title JENKINS-76185 Add gitlab Merge Request compatibility. [JENKINS-76185] Add GitLab merge request compatibility Oct 10, 2025
@BartVerc
Copy link
Copy Markdown
Author

@MarkEWaite Thanks for picking this up 👍

@MarkEWaite
Copy link
Copy Markdown
Contributor

I will be on vacation for 2 weeks and won't look further at this until after I return. The plugin needs better documentation to show how to use pull requests as a parameter. If you can help with that documentation and can confirm that it works, that would be great.

@BartVerc
Copy link
Copy Markdown
Author

BartVerc commented Nov 6, 2025

Hi @MarkEWaite, I just tested this feature and added the documentation for a Gitlab merge request example. It worked as expected.

@BartVerc
Copy link
Copy Markdown
Author

@MarkEWaite I think this is ready for review or merge. Let me know if something else needs to be done.

@MarkEWaite
Copy link
Copy Markdown
Contributor

@MarkEWaite I think this is ready for review or merge. Let me know if something else needs to be done.

Thanks! It will likely be several more weeks before I can review it. Many other things are on my list.

@BartVerc
Copy link
Copy Markdown
Author

BartVerc commented Jan 8, 2026

Hi @MarkEWaite, any idea when you have time to review this?

@MarkEWaite
Copy link
Copy Markdown
Contributor

Hi @MarkEWaite, any idea when you have time to review this?

Sorry for the slow progress, but other efforts have received my time. Currently we are preparing for the release of Jenkins 2.541.1 on Jan 21, 2026 and for Jenkins Contributor Summit Jan 30, 2026. It may be Feb 2026 before I look at this.

@MarkEWaite
Copy link
Copy Markdown
Contributor

@BartVerc your comment in the pull request description says that you did not test it manually. Could you test it interactively to confirm that it is working as expected? The change looks good to me. I've asked GitHub Copilot to review it as well, in case it finds something that I missed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the plugin’s PT_PULL_REQUEST support to recognize GitLab merge request refs alongside the existing GitHub and Bitbucket pull request refs, so merge request IDs can be offered in the same parameter type.

Changes:

  • Updated the pull-request ref regex to also match GitLab refs/merge-requests/<id>/head refs.
  • Adjusted pull-request ID extraction to use the numeric capture group from the new regex.
  • Added regex-focused tests and expanded the README with GitHub/GitLab usage examples.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/Consts.java Broadens the ref-matching pattern to include GitLab merge request refs.
src/main/java/net/uaznia/lukanus/hudson/plugins/gitparameter/GitParameterDefinition.java Switches pull-request ID extraction to the new regex capture group.
src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/BasicTests.java Updates regex assertions and adds a GitLab merge-request match case.
src/test/java/net/uaznia/lukanus/hudson/plugins/gitparameter/BasicSafeTests.java Mirrors the regex assertion updates and GitLab coverage in the safe test suite.
README.md Documents merge-request support and adds updated checkout examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
@@ -146,14 +153,39 @@ pipeline {
stage('Example') {
steps {
checkout scmGit(branches: [[name: "pr/${params.A_PULL_REQUEST}/head"]],
Matcher matcher = PULL_REQUEST_REFS_PATTERN.matcher(remoteReference);
if (matcher.find()) {
pullRequestSet.add(matcher.group(1));
pullRequestSet.add(matcher.group(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants