diff --git a/pom.xml b/pom.xml
index ce92d8b..f227e4a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,7 +61,7 @@
org.jenkins-ci.plugins
gitlab-plugin
- 1.4.5
+ 1.5.3
org.jenkins-ci.plugins
@@ -118,7 +118,6 @@
org.jenkins-ci.plugins.workflow
workflow-scm-step
2.4
- test
@@ -269,4 +268,4 @@
-
\ No newline at end of file
+
diff --git a/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/SourceActions.java b/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/SourceActions.java
index d00f705..31d33fa 100644
--- a/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/SourceActions.java
+++ b/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/SourceActions.java
@@ -76,7 +76,7 @@ private List retrieve(@Nonnull GitLabSCMHead head, @CheckForNull SCMHead
linkAction = GitLabLinkAction.toMergeRequest(mr.getWebUrl());
if (acceptMergeRequest(head)) {
boolean removeSourceBranch = mr.getRemoveSourceBranch() || removeSourceBranch(head);
- actions.add(new GitLabSCMAcceptMergeRequestAction(mr.getProjectId(), mr.getId(), mr.getIid(), source.getSourceSettings().getMergeCommitMessage(), removeSourceBranch));
+ actions.add(new GitLabSCMAcceptMergeRequestAction(mr, mr.getIid(), source.getSourceSettings().getMergeCommitMessage(), removeSourceBranch));
}
} else {
linkAction = (head instanceof TagSCMHead) ? GitLabLinkAction.toTag(source.getProject(), head.getName()) : GitLabLinkAction.toBranch(source.getProject(), head.getName());
diff --git a/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMAcceptMergeRequestAction.java b/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMAcceptMergeRequestAction.java
index a45a763..fb9655e 100644
--- a/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMAcceptMergeRequestAction.java
+++ b/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMAcceptMergeRequestAction.java
@@ -2,7 +2,9 @@
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty;
-import com.dabsquared.gitlabjenkins.gitlab.api.GitLabApi;
+import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient;
+import argelbargel.jenkins.plugins.gitlab_branch_source.api.GitLabMergeRequest;
+import com.dabsquared.gitlabjenkins.gitlab.api.model.MergeRequest;
import hudson.model.InvisibleAction;
import hudson.model.Run;
import hudson.model.TaskListener;
@@ -17,27 +19,30 @@
public final class GitLabSCMAcceptMergeRequestAction extends InvisibleAction implements Serializable {
private static final Logger LOGGER = Logger.getLogger(GitLabSCMAcceptMergeRequestAction.class.getName());
- private final int projectId;
- private final int mergeRequestId;
+ private final int mergeRequestID;
+ private final int mergeRequestPID;
private final int mergeRequestScopedId;
private final String commitMessage;
private final boolean removeSourceBranch;
- public GitLabSCMAcceptMergeRequestAction(int projectId, int mergeRequestId, int mergeRequestScopedId, String commitMessage, boolean removeSourceBranch) {
- this.projectId = projectId;
- this.mergeRequestId = mergeRequestId;
+ public GitLabSCMAcceptMergeRequestAction(GitLabMergeRequest MR, int mergeRequestScopedId, String commitMessage, boolean removeSourceBranch) {
+ this.mergeRequestPID = MR.getProjectId();
+ this.mergeRequestID = MR.getId();
this.mergeRequestScopedId = mergeRequestScopedId;
this.commitMessage = commitMessage;
this.removeSourceBranch = removeSourceBranch;
}
public void acceptMergeRequest(Run, ?> build, TaskListener listener) {
- GitLabApi client = GitLabConnectionProperty.getClient(build);
+ MergeRequest mergeRequest = new MergeRequest();
+ mergeRequest.setProjectId(mergeRequestPID);
+ mergeRequest.setId(mergeRequestID);
+ GitLabClient client = GitLabConnectionProperty.getClient(build);
if (client == null) {
listener.getLogger().format("cannot publish build-status pending as no gitlab-connection is configured!");
} else {
try {
- client.acceptMergeRequest(projectId, mergeRequestId, MessageFormat.format(commitMessage, mergeRequestScopedId, build.getFullDisplayName()), removeSourceBranch);
+ client.acceptMergeRequest(mergeRequest, MessageFormat.format(commitMessage, mergeRequestScopedId, build.getFullDisplayName()), removeSourceBranch);
} catch (Exception e) {
listener.getLogger().format("failed to accept merge-request: " + e.getMessage());
LOGGER.log(SEVERE, "failed to accept merge-request", e);
diff --git a/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMBuildStatusPublisher.java b/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMBuildStatusPublisher.java
index bebf18a..9eeaf1d 100644
--- a/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMBuildStatusPublisher.java
+++ b/src/main/java/argelbargel/jenkins/plugins/gitlab_branch_source/actions/GitLabSCMBuildStatusPublisher.java
@@ -2,7 +2,7 @@
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig;
-import com.dabsquared.gitlabjenkins.gitlab.api.GitLabApi;
+import com.dabsquared.gitlabjenkins.gitlab.api.GitLabClient;
import com.dabsquared.gitlabjenkins.gitlab.api.model.BuildState;
import hudson.init.Terminator;
import hudson.model.Run;
@@ -86,7 +86,7 @@ private Message(String connectionName, Run, ?> run, int projectId, String hash
@Override
public void run() {
- GitLabApi client = getClient(connectionName);
+ GitLabClient client = getClient(connectionName);
if (client == null) {
LOGGER.log(WARNING, "cannot publish build-status pending as no gitlab-connection is configured!");
} else {
@@ -98,7 +98,7 @@ public void run() {
}
}
- private GitLabApi getClient(String connectionName) {
+ private GitLabClient getClient(String connectionName) {
GitLabConnectionConfig config = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class);
return config != null ? config.getClient(connectionName) : null;
}