Merge pull request #182 from sebastienbonami/canceled_status

Status to canceled instead of failed if Jenkins build is aborted
This commit is contained in:
Owen Mehegan 2016-02-16 12:00:29 -08:00
commit 9c3e58734a
2 changed files with 20 additions and 2 deletions

View File

@ -490,7 +490,15 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
private void onCompletedPushRequest(Run run, GitLabPushCause cause) {
if(addCiMessage) {
cause.getPushRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failed", Jenkins.getInstance().getRootUrl() + run.getUrl());
String status;
if (run.getResult() == Result.ABORTED) {
status = "canceled";
}else if (run.getResult() == Result.SUCCESS) {
status = "success";
}else {
status = "failed";
}
cause.getPushRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), status, Jenkins.getInstance().getRootUrl() + run.getUrl());
}
}
@ -531,7 +539,15 @@ public class GitLabPushTrigger extends Trigger<Job<?, ?>> {
}
if(addCiMessage) {
cause.getMergeRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), run.getResult()==Result.SUCCESS?"success":"failed", Jenkins.getInstance().getRootUrl() + run.getUrl());
String status;
if (run.getResult() == Result.ABORTED) {
status = "canceled";
}else if (run.getResult() == Result.SUCCESS) {
status = "success";
}else {
status = "failed";
}
cause.getMergeRequest().createCommitStatus(this.getDescriptor().getGitlab().instance(), status, Jenkins.getInstance().getRootUrl() + run.getUrl());
}
}

View File

@ -243,6 +243,8 @@ public class GitLabWebHook implements UnprotectedRootAction {
//TODO: add status of pending when we figure it out.
if(mainBuild.isBuilding()) {
object.put("status", "running");
}else if(res == Result.ABORTED) {
object.put("status", "canceled");
}else if(res == Result.SUCCESS) {
object.put("status", "success");
}else {