jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.44k stars 619 forks source link

How to get a gitlabClient to call e.g. createMergeRequest(...) from Declarative Jenkins Pipeline #1388

Open sebastianzillessen opened 1 year ago

sebastianzillessen commented 1 year ago

Describe your use-case which is not covered by existing documentation.

We would like to call GitLabClient#createMergeRequest(...) from our Jenkinsfile (Declarative Pipeline).

How can we get a current instance of the GitLabClient? I did not find any documentation on this.

Thanks for helping out.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

https://github.com/jenkinsci/gitlab-plugin/blob/9d32eea43bed3aaf93da9cc3aea6d92c74cd8aa8/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api/GitLabClient.java#L19

krisstern commented 1 year ago

Hi @sebastianzillessen Could you please provide more context such as your use case so we could provide more information?

sumitNITS commented 1 year ago

Hi @sebastianzillessen, Can you please share a few more details in regard to your issue mentioning the use cases of it so that we can work on the code?

The portion that I have understood after going through the resource pointed out by you (gitlab-plugin/src/main/java/com/dabsquared/gitlabjenkins/gitlab/api /GitLabClient.java) is that the code provided in there only defines the GitLabClient interface and its methods. In order to get a current instance of the GitLabClient we can go ahead and implement this to a class separately along with it.

walnut-tom commented 1 year ago

is createMergeRequest in jenkins Pipeline?