> {
}
}
+ if(addCiMessage) {
+ cause.getMergeRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failure", Jenkins.getInstance().getRootUrl() + run.getUrl());
+ }
}
public void onStarted(Run run) {
setBuildCauseInJob(run);
+
+ Cause mCause= run.getCause(GitLabMergeCause.class);
+ if (mCause != null && mCause instanceof GitLabMergeCause) {
+ onStartedMergeRequest(run, (GitLabMergeCause) mCause);
+ }
+
+ Cause pCause= run.getCause(GitLabPushCause.class);
+ if (pCause != null && pCause instanceof GitLabPushCause) {
+ onStartedPushRequest(run, (GitLabPushCause) pCause);
+ }
+ }
+
+ private void onStartedPushRequest(Run run, GitLabPushCause cause) {
+ if(addCiMessage) {
+ cause.getPushRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), "running", Jenkins.getInstance().getRootUrl() + run.getUrl());
+ }
+ }
+
+ private void onStartedMergeRequest(Run run, GitLabMergeCause cause) {
+ if(addCiMessage) {
+ cause.getMergeRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), "running", Jenkins.getInstance().getRootUrl() + run.getUrl());
+ }
}
private String getSourceBranch(GitLabRequest req) {
diff --git a/src/main/java/com/dabsquared/gitlabjenkins/GitLabRequest.java b/src/main/java/com/dabsquared/gitlabjenkins/GitLabRequest.java
index 19eb166..8621f33 100644
--- a/src/main/java/com/dabsquared/gitlabjenkins/GitLabRequest.java
+++ b/src/main/java/com/dabsquared/gitlabjenkins/GitLabRequest.java
@@ -14,8 +14,10 @@ import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;
+import org.gitlab.api.GitlabAPI;
+import org.gitlab.api.models.GitlabCommitStatus;
-public class GitLabRequest {
+public abstract class GitLabRequest {
protected enum Builder {
INSTANCE;
private final Gson gson;
@@ -51,4 +53,6 @@ public class GitLabRequest {
}
}
+ public abstract GitlabCommitStatus createCommitStatus(GitlabAPI api, String status, String targetUrl);
+
}
diff --git a/src/main/resources/com/dabsquared/gitlabjenkins/GitLabPushTrigger/config.jelly b/src/main/resources/com/dabsquared/gitlabjenkins/GitLabPushTrigger/config.jelly
index 3655f8f..bc68fa6 100644
--- a/src/main/resources/com/dabsquared/gitlabjenkins/GitLabPushTrigger/config.jelly
+++ b/src/main/resources/com/dabsquared/gitlabjenkins/GitLabPushTrigger/config.jelly
@@ -1,6 +1,6 @@
-
+
@@ -17,23 +17,31 @@
+
+
+
-
+
-
-
+
+
+
+
+
-
-
+
+
-
-
-
\ No newline at end of file
+
+
+
+
+
+
diff --git a/src/main/webapp/help/help-gitlab8.1CI.html b/src/main/webapp/help/help-gitlab8.1CI.html
new file mode 100644
index 0000000..c6d0371
--- /dev/null
+++ b/src/main/webapp/help/help-gitlab8.1CI.html
@@ -0,0 +1,3 @@
+
+ Enable GitLab 8.1 Continuous Integration feature. DO NOT ENABLE IF YOU'RE USING A VERSION BEFORE GITLAB 8.1.
+
\ No newline at end of file